summaryrefslogtreecommitdiff
path: root/src/signaler.cpp
AgeCommit message (Collapse)Author
2012-06-01Assertions improvedMartin Sustrik
This patch is replaces generic xs_asserts by errno_assers and alloc_asserts as appropriate. It is based on 0MQ patch by Martin Hurton. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-05-21Use global event to synchronise signaler creation on WindowsMartin Sustrik
So far, the event used for signaler creation was local to the session, so, in theory, processes in two different sessions could accidentally interconnect their signalers. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-05-12Inheritance on signaler's socket on Windows switched offMartin Sustrik
Accidentally, one of the sockets in Windows signaler_t was opened usign WSASocket instead of xs::open_socket. That skipped the standard XS socket initialisation and caused the socket to be inheritable to the child processes. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-04-22Initialise fd_set once for signler_t objectMartin Sustrik
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>
2012-04-21Select polling mechanisms at one placeMartin Sustrik
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>
2012-04-16Honour --with-poller option for synchronous pollingMartin Sustrik
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>
2012-04-15Report EMFILE/ENFILE from xs_socket()Martin Sustrik
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>
2012-04-14If available, use MSG_NOSIGNAL for send()Martin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-04-14Set options on new sockets in systematic mannerMartin Sustrik
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>
2012-04-08Set CLOEXEC flag on fds used by signalerMartin Sustrik
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>
2012-03-25Signaler's global event is now accessible by everyoneMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-03-23Add long comment about security problem on Windows platformMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-02-16Full name of the project used in license headersMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-02-16Small error in a comment fixedMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-02-16ZeroMQ renamed to CrossroadsMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-11-10Hangup in signaler creation on Windows fixedMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-11-04Merge branch 'master' of github.com:zeromq/libzmqMartin Sustrik
2011-11-01Copyright dates adjusted to reflect realityMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-10-31250bpm copyrights addedMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-09-29Use single port for creating signalers on WindowsMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-09-02Close file descriptors on exec (issue 218)Martin Sustrik
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>
2011-07-29Different connecters simplifiedMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-07-18Fix pollin on Cygwin.Steven McCoy
Signed-off-by: Steven McCoy <steven.mccoy@miru.hk> Signed-off-by: Martin Sustrik <sustrik@250bom.com>
2011-07-18Signaler timeout bug on Windows fixedMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-07-03Merge branch 'master' of github.com:zeromq/libzmqMartin Sustrik
2011-07-03Race condition in eventfd signaler fixedMartin Sustrik
recv function on eventfd signaler could accidentally grab two signals instead of one. Fixed. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-07-03eventfd implementation of the signalerMartin Sustrik
Eventfd (on Linux) is more efficient that socketpair for passing simple signals. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-07-03Fix MSVC buildMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-07-03Command are now stored in ypipes instead of in socketpairsMartin Sustrik
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>
2010-11-05signaler renamed to mailboxMartin Sustrik
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>
2010-11-04Automatically resize signalling socket buffer if fullMartin Lucina
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>
2010-10-30Name of "GNU Lesser Public License" corrected.Martin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2010-10-08Scalability improvements for large amounts of connectionsMartin Lucina
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>
2010-09-08EINTR returned from the blocking functionsMartin Sustrik
2010-09-02Fix for signaler_t on HP-UX and AIX platformsBernd Melchers
2010-08-06Fix uninitialized use of nbytes in signaler fixMartin Lucina
2010-08-05zmq::signaler_t: Restart syscalls on EINTRMartin Lucina
This patch restarts the send() or recv() inside zmq::signaler_t if the call fails due to EINTR.
2010-05-12fixes for OpenVMSBrett Cameron
2010-05-04Windows port fixedMartin Sustrik
2010-05-04signaler transports commands per se rather than one-bit signalsMartin Sustrik
2010-04-29windows port fixedMartin Sustrik
2010-04-29signaler rewritten in such a way that any number (>64) of threads can be usedMartin Sustrik
2010-04-29eventfd-style signaling removedMartin Sustrik
2010-04-29fd_signaler_t renamed to signaler_tMartin Sustrik