Commit Graph

16 Commits

Author SHA1 Message Date
Martin Sustrik
7c0c798120 Command are now stored in ypipes instead of in socketpairs
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>
2011-07-03 13:33:45 +02:00
Martin Sustrik
9da84a5239 signaler renamed to mailbox
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-05 17:39:51 +01:00
Martin Lucina
1b39bcd883 Automatically resize signalling socket buffer if full
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-11-04 17:54:47 +01:00
Martin Sustrik
b358df9fff Name of "GNU Lesser Public License" corrected.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2010-10-30 15:08:28 +02:00
Martin Lucina
f90c8d957e Scalability improvements for large amounts of connections
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-10-08 17:49:40 +02:00
Martin Sustrik
91ea204644 EINTR returned from the blocking functions 2010-09-08 08:39:27 +02:00
Bernd Melchers
8ec0743c75 Fix for signaler_t on HP-UX and AIX platforms 2010-09-02 07:33:57 +02:00
Martin Lucina
6d35e82db4 Fix uninitialized use of nbytes in signaler fix 2010-08-06 12:00:57 +02:00
Martin Lucina
9ac2ff449c zmq::signaler_t: Restart syscalls on EINTR
This patch restarts the send() or recv() inside zmq::signaler_t if the call fails
due to EINTR.
2010-08-05 23:40:30 +02:00
Brett Cameron
714a8d50a0 fixes for OpenVMS 2010-05-12 12:45:12 +02:00
Martin Sustrik
3f5465ada1 Windows port fixed 2010-05-04 10:37:10 +02:00
Martin Sustrik
235ed3a3dc signaler transports commands per se rather than one-bit signals 2010-05-04 10:22:16 +02:00
Martin Sustrik
beb4da3c28 windows port fixed 2010-04-29 20:53:46 +02:00
Martin Sustrik
ae93ed318a signaler rewritten in such a way that any number (>64) of threads can be used 2010-04-29 20:34:48 +02:00
Martin Sustrik
1ffc6dd41f eventfd-style signaling removed 2010-04-29 18:03:54 +02:00
Martin Sustrik
37128b7b1a fd_signaler_t renamed to signaler_t 2010-04-29 17:31:57 +02:00