Commit Graph

43 Commits

Author SHA1 Message Date
Martin Hurton
e56f698023 choose_io_thread: do not assert when no I/O thread was chosen 2012-03-22 07:47:39 +01:00
Martin Hurton
f944336ee0 Fix race condition in find_endpoint 2012-03-22 07:47:38 +01:00
Pieter Hintjens
6e71a54b1e Fixed issues #337, #341, and #340
* Implemented new ctx API (_new, _destroy, _get, _set)
* Removed 'typesafe' macros from zmq.h
* Added support for MAX_SOCKETS (was tied into change for #337)
* Created new man pages
2012-03-19 19:41:20 -05:00
Pieter Hintjens
bdefa181ed Fixed issue 336 2012-03-19 16:15:09 -05:00
Pieter Hintjens
06dd31c56a Removed last vestiges of thread-safe sockets 2012-03-19 15:50:53 -05:00
Pieter Hintjens
afe8cd503f Revert "fix warn unused"
- anonymous contributor

This reverts commit 7b7d404269.
2012-02-14 18:43:33 -06:00
niXman
7b7d404269 fix warn unused 2012-02-10 13:39:34 +04:00
skaller
520ad3c2d7 Set and arrange propagation of thread safe sockets flag.
We use a distinct context initialisation function to specify
all sockets derived therefrom will be thread safe.

However the inheritance is done exclusively in the C interface.
This is not really correct, but it is chosen to minimise
interference with the existing C++ code, including any
construct or other calls within the C++ code base.
Semantically the C++ code should be unchanged,
physically some data structures and extra methods are
provided by they're only used from the C binding.
2012-02-04 02:17:35 +11:00
Martin Sustrik
ac7717b7b3 250bpm copyrights added
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-10-31 16:20:30 +01:00
Martin Sustrik
4b60023b96 Merge branch 'master' of github.com:zeromq/libzmq 2011-06-19 09:15:06 +02:00
Steven McCoy
9b795de4af Refactor Windows versioning and WinSock usage.Signed-off-by: Steven McCoy <steven.mccoy@miru.hk> 2011-06-18 20:44:03 +02:00
Fabien Ninoles
d7923f08ca Add sockopt ZMQ_RCVTIMEO/ZMQ_SNDTIMEO.
- Add doc and tests
- Add options and setup
- Wait using poll/select

Signed-off-by: Fabien Ninoles <fabien@tzone.org>
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-06-17 12:22:02 +02:00
Martin Sustrik
c7fb5c54b6 Reverting previous commit that broke MSVC2010 build
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-06-13 07:53:22 +02:00
Steven McCoy
b164023cca Fix scope on Windows includes.
Fix windows.h included before winsock2.h.
Remove definition of _WINSOCKAPI_.

Signed-off-by: Steven McCoy <steven.mccoy@miru.hk>
2011-06-12 19:37:11 +02:00
Martin Sustrik
e0246e32d7 Message-related functionality factored out into msg_t class.
This patch addresses serveral issues:
1. It gathers message related functionality scattered over whole
   codebase into a single class.
2. It makes zmq_msg_t an opaque datatype. Internals of the class
   don't pollute zmq.h header file.
3. zmq_msg_t size decreases from 48 to 32 bytes. That saves ~33%
   of memory in scenarios with large amount of small messages.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-04-21 22:27:48 +02:00
Martin Sustrik
b96fe15bb6 Run-time checking for context & socket validity added
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-04-09 09:35:34 +02:00
Martin Sustrik
18b9ebea32 The copyrights in file headers updated.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-03-02 16:30:40 +01:00
Martin Sustrik
43e8868875 Added explicit error message in case of memory exhaustion
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-02-22 16:23:36 +01:00
Martin Sustrik
17e2ca71b4 Logging of duplicit identities added
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-02-18 14:15:10 +01:00
Pieter Hintjens
14a0e147b2 Fixed win32 issue with WSAStartup
- ctx constructor was calling mailbox_t constructor implicitly
 - moved WSAStartup and WSACleanup to be outside constructor/destructor

Signed-off-by: Pieter Hintjens <ph@imatix.com>
2011-02-12 18:36:21 +01:00
Martin Sustrik
80ac398bba Initial implementation of reaper thread.
Reaper thread destroys the socket asynchronously.
zmq_term() can be interrupted by a signal (EINTR).
zmq_socket() will return ETERM after zmq_term() was called.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-02-09 15:32:15 +01:00
Martin Sustrik
889424e675 max_sockets honoured precisely
The internal log socket was subtracted from the number of
available sockets. So, if max_sockets was set to 100,
you could create only 99 sockets. Fixed.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-02-08 16:19:37 +01:00
Martin Sustrik
56bdba592c Fix cppcheck warnings: Prefer prefix ++/-- operators for non-primitive types.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-01-18 15:57:45 +01:00
Martin Sustrik
bd0ba6e89a Size of inproc hwm and swap is sum of peers' hwms and swaps
The meat of the patch was contributed by Douglas Creager.
Martin Sustrik implemented storing peer options in inproc
endpoint repository.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2011-01-10 13:53:30 +01: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 Sustrik
9cfdb441f4 slots renamed to tids
Threads were so far identified by integers called 'slots'.
This patch renames them to more comprehensible 'tid's (thread IDs).

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2010-11-05 16:38:52 +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 Sustrik
b7386f5b50 To insert to associateive STL containers value_type used instead of make_pair
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2010-10-14 12:13:52 +02:00
Martin Sustrik
16c3884a61 MSVC build fixed 2010-09-27 11:18:21 +02:00
Martin Sustrik
cda3c96a7f minor code reorganisation in ctx_t::terminate 2010-09-19 22:17:37 +02:00
Martin Sustrik
938689a491 synchronisation problem fixed in ctx_t 2010-09-19 21:40:26 +02:00
Martin Sustrik
a68e6739f4 when no I/O threads are available error is raised instead of assertion 2010-09-09 08:25:00 +02:00
Martin Sustrik
91ea204644 EINTR returned from the blocking functions 2010-09-08 08:39:27 +02:00
Martin Sustrik
0fe7d3c998 conflicts resolved 2010-09-01 15:29:19 +02:00
Martin Sustrik
651c1adc80 sys transport introdced; inproc://log moved to sys://log 2010-09-01 15:24:46 +02:00
Martin Sustrik
6a0c323bb2 MSVC build fixed 2010-09-01 13:31:45 +02:00
Martin Sustrik
ce0972dca3 context creates an inproc endpoint ('inproc://log') to distribute 0MQ's log messages 2010-09-01 07:57:38 +02:00
Martin Sustrik
45f83d78a5 one more dezombification bug fixed 2010-08-25 15:39:20 +02:00
Martin Sustrik
936dbf956b dezombification procedure fixed 2010-08-25 15:39:20 +02:00
Martin Sustrik
d13933bc62 I/O object hierarchy implemented 2010-08-25 15:39:20 +02:00
Martin Sustrik
05d908492d WIP: Socket migration between threads, new zmq_close() semantics
Sockets may now be migrated between OS threads; sockets may not be used by
more than one thread at any time. To migrate a socket to another thread the
caller must ensure that a full memory barrier is called before using the
socket from the target thread.

The new zmq_close() semantics implement the behaviour discussed at:

http://lists.zeromq.org/pipermail/zeromq-dev/2010-July/004244.html

Specifically, zmq_close() is now deterministic and while it still returns
immediately, it does not discard any data that may still be queued for
sending. Further, zmq_term() will now block until all outstanding data has
been sent.

TODO: Many bugs have been introduced, needs testing. Further, SO_LINGER or
an equivalent mechanism (possibly a configurable timeout to zmq_term())
needs to be implemented.
2010-08-25 15:39:20 +02:00
Piotr Trojanek
c818b14bbd clearing thread info structure 2010-06-10 12:57:42 +02:00
Martin Sustrik
835e893e54 dispatcher_t class renamed to ctx_t 2010-05-05 14:24:54 +02:00