Age | Commit message (Collapse) | Author |
|
Optimisation. Up to now new fd_set was initialised in
each signaler_wait call. Now the fd_set is initialised
once when signaler is created. This is useful espacially on
Windows where fd_set is list of pointers rather than bitset
and thus can be rather large.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
|
|
This patch provides a single place for selecting polling mechanisms
(polling.hpp). Up to now the selection was spread among the build
system and several source files.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
|
|
While --with-poller configure option could be used for selecting
the polling mechanism for I/O threads (asynchronous), synchronous
polling (xs_poll, signaler_t) was not affected by the option.
This patch uses selected mechanism is it is either 'select' or 'poll'.
Othrwise it chooses the mechanism according to the platform.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
|
|
This patch propoagates the error from signaler and mailbox
initialisation up the stack.
To achieve this signaler and mailbox classes were re-written
is C-like syntax.
Finally, shutdown_stress test now ignores EMFILE/ENFILE errors.
Thus, the tests should pass even on OSX which sets the max
number of file descriptors pretty low by default.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
|
|
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
|
|
This patch consolidates the up-to-now scattered code that
sets different options on newly created sockets.
There are open_socket and open_tcp_socket functions that
do the tuning automatically.
In case the socket is not created but got from elsewhere
(such as accept() call) there are tune_socket and tune_tcp_socket
functions that will do the tuning.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
|
|
While TCP and IPC socket duplicates are correctly closed on
fork+exec, file descriptors used for internal communication
within libxs are not. This patch fixes the problem.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
|
|
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
|
|
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
|
|
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
|
|
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
|
|
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
|
|
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
|
|
|
|
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
|
|
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
|
|
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
|
|
When exec is executed to start a different process image old
0MQ file descriptors could stay open, thus blocking TCP ports
and alike. This patch should solve the problem.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
|
|
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
|
|
Signed-off-by: Steven McCoy <steven.mccoy@miru.hk>
Signed-off-by: Martin Sustrik <sustrik@250bom.com>
|
|
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
|
|
|
|
recv function on eventfd signaler could accidentally
grab two signals instead of one. Fixed.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
|
|
Eventfd (on Linux) is more efficient that socketpair
for passing simple signals.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
|
|
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
|
|
Storing commands in OS socket buffers caused whole lot of
problems when free space in the buffer ran out. This patch
stores commands in ypipes instead and uses socketpair just
to signal the other thread, ie. at most one byte is stored
in the socketpair at any single instant.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
|
|
For historical reasons queue to transfer commands between
threads was called 'signaler'. Given that it was used to
pass commands rather than signals it was renamed to 'mailbox',
see Erlang mailboxes.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
|
|
If the socketpair used by signaler_t fills up, this can lead to deadlock.
This patch provides partial resolution by attempting to resize SO_SNDBUF on
the writer side, and if that fails we shall at least assert rather than
hang.
I've also refactored the signaler_t code to make the platform-dependent
parts clearer and have tested both the MSG_DONTWAIT and standard POSIX path
in recv.
The Win32 implementation currently does not implement resizing as I'm not
convinced that it's safe, but it will also assert like other platforms if
signaler_t::send() cannot succeed.
The OpenVMS implementation has been carried forward but is untested.
Signed-off-by: Martin Lucina <mato@kotelna.sk>
|
|
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
|
|
Add signaler_sndbuf_size option to config.hpp which allows the user to
increase the size of the send buffer used by the signalling socketpair.
Implement random backoff for reconnection attempts using a primitive
pseudo-random generation to prevent reconnection storms.
Add wait_before_connect option to config.hpp to allow the user to enable
random delay even on initial connect. Default is false for low latency.
Signed-off-by: Martin Lucina <mato@kotelna.sk>
|
|
|
|
|
|
|
|
This patch restarts the send() or recv() inside zmq::signaler_t if the call fails
due to EINTR.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|