heap: fix `heap_remove()`

Remove should shuffle items in both directions, not just down. It is
required, because `max` node could be not the actual maximum value in
the tree.

fix #1267

Signed-off-by: Fedor Indutny <fedor@indutny.com>
windows: remove redundant code in uv_tcp_write

The overlapped structure is reset twice, it is non necessary.

Signed-off-by: Fedor Indutny <fedor@indutny.com>
unix, windows: define UV__INET/6_ADDRSTRLEN constants
unix, windows: fix parsing scoped IPv6 addresses

Signed-off-by: Saúl Ibarra Corretgé <saghul@gmail.com>
doc: clarify return value when UV_RUN_NOWAIT is used

Signed-off-by: Saúl Ibarra Corretgé <saghul@gmail.com>
windows: fix handling closed socket while poll handle is closing

fixes #1278
unix, windows: make uv_barrier_wait() return bool

Make uv_barrier_wait() return a boolean value indicating whether this
thread was the "serializer".

From `man pthread_barrier_wait`:

    Upon successful completion, the pthread_barrier_wait() function
    shall return PTHREAD_BARRIER_SERIAL_THREAD for a single (arbitrary)
    thread synchronized at the barrier and zero for each of the other
    threads.

Exposing that information from libuv is useful because it can make
cleanup significantly easier:

    if (uv_barrier_wait(&barrier) > 0)
      uv_barrier_destroy(&barrier);

Signed-off-by: Fedor Indutny <fedor@indutny.com>
include: document barrier functions

Add some basic doc comments to the uv_barrier_*() functions and document
the "serializer" return value from the previous commit.

Signed-off-by: Fedor Indutny <fedor@indutny.com>
test: make barrier test more rigorous

A correct barriers implementation blocks in uv_barrier_destroy() until
the last thread returns from uv_barrier_wait() so make the test more
rigorous by destroying the barrier straight away instead of first
joining the worker thread.

Signed-off-by: Fedor Indutny <fedor@indutny.com>
doc: remove requirement for signing the CLA
windows: fix PYTHON environment variable usage

- (README.md) The PYTHON environment variable should point to python.exe
not the python directory.

- (vcvars.bat) The PYTHON environment variable should be quoted on
expansion in case there's spaces in the path.
unix, windows: return system error on EAI_SYSTEM
unix: don't run i/o callbacks after prepare callbacks

Run them after timers, like Windows does.

Closes #1317
unix: allow uv_getnameinfo to be cancelled
build: add pthread-fixes.c to Makefile.am on Android
windows: add tty unicode support for input

Switches from using ReadConsoleA to ReadConsoleW.
Uses an auxiliary buffer to store the temporary utf-16 string.

Signed-off-by: Peter Atashian <retep998@gmail.com>
Signed-off-by: Saúl Ibarra Corretgé <saghul@gmail.com>
build: fix compilation warning on MinGW-w64
build: add missing file to Makefile.mingw
Fix build on mingw32
Merge branch 'master' into fix_mingw