This functionality is present in stream and uv_udp_t has a queue
as well so it makes sense for udp to have a send_write_size.
Since udp sends entire messages atomically, the send_queue_count field
lets the user determine how many messages are there left to send.
We add a function called uv_loop_size which returns the size of
the loop. It is an additional function which complements
`uv_handle_size` and` uv_req_size` in order to provide full FFI
support.
Signed-off-by: Fedor Indutny <fedor@indutny.com>
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>
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>
The fields for UV_HANDLE_PRIVATE_FIELDS in uv-win.h and uv-unix.h are
the same, but in different order. Simply swap them so uv_handle_t are
the same on both platforms.
Signed-off-by: Fedor Indutny <fedor@indutny.com>
Changes since version 0.11.22:
* fs: avoid using readv/writev where possible (Fedor Indutny)
* mingw: fix build with autotools (Saúl Ibarra Corretgé)
* bsd: support IPv6 qualified link-local addresses (Saúl Ibarra Corretgé)
* unix: add UV_HANDLE_IPV6 flag to tcp and udp handles (Saúl Ibarra Corretgé)
* unix, windows: do not set SO_REUSEADDR by default on udp (Saúl Ibarra
Corretgé)
* windows: fix check in uv_tty_endgame() (Maks Naumov)
* unix, windows: add IPv6 support for uv_udp_multicast_interface (Saúl Ibarra
Corretgé)
* unix: fallback to blocking writes if reopening a tty fails (Saúl Ibarra
Corretgé)
* unix: fix handling uv__open_cloexec failure (Saúl Ibarra Corretgé)
* unix, windows: add IPv6 support to uv_udp_set_membership (Saúl Ibarra
Corretgé)
* unix, windows: removed unused status parameter (Saúl Ibarra Corretgé)
* android: add support of ifaddrs in android (Javier Hernández)
* build: fix SunOS and AIX build with autotools (Saúl Ibarra Corretgé)
* build: freebsd link with libelf if dtrace enabled (Saúl Ibarra Corretgé)
* stream: do not leak `alloc_cb` buffers on error (Fedor Indutny)
* unix: fix setting written size on uv_wd (Saúl Ibarra Corretgé)
Signed-off-by: Fedor Indutny <fedor@indutny.com>
Add UV_UDP_REUSEADDR flag instead, which can be passed to uv_udp_bind.
If the udp handle is unbound when uv_udp_set_memberhsip or
uv_udp_set_multicast_interface is called, the handle will be bound with
UV_UDP_REUSEADDR set.
Introduce `int uv_pipe_pending_count(uv_pipe_t*)` and
`uv_handle_type uv_pipe_pending_type(uv_pipe_t*)`. They should be
used in IPC pipe's read cb to accept incoming handles:
int count = uv_pipe_pending_count(pipe);
int i;
for (i = 0; i < count; i++) {
uv_handle_type type = uv_pipe_pending_type(pipe);
/* ... */
uv_accept(...);
}
Changes since version 0.11.20:
* unix: fix uv_fs_write when using an empty buffer (Saúl Ibarra
Corretgé)
* unix, windows: add assertion in uv_loop_delete (Saúl Ibarra Corretgé)