summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2012-04-29Refine documentation for XS_FD optionIan Barber
2012-04-29Patrick Trantham added to the AUTHORS fileMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-04-29atomic: prever inline asm over GCC builtins for armv7aAndrew W. Nosenko
As per Patrick Trantham comment http://groups.crossroads.io/r/topic/510xaadGgWVcXFdATnhAuN the GCC __sync_*() builtins are more generic but slower than specialized hand-written assembly for armv7a case. Therefore, the code is reordered for prefer inline assembly for armv7a over GCC builtins. * src/atomic_counter.hpp: (atomic_counter_t::add): (atomic_counter_t::sub): * src/atomic_ptr.hpp: (atomic_ptr_t::xchg): (atomic_ptr_t::cas): Prefer armv7a specific inline asm over GCC __sync_*() builtins.
2012-04-29atomic: revisit the atomic operation checks and their usageAndrew W. Nosenko
* configure.ac: Check for working Solaris/NetBSD-style atomic.h independly on OS. Add check for GCC-style __sync_*() builtins. New defines: XS_ATOMIC_GCC_SYNC, XS_ATOMIC_SOLARIS. Removed define: XS_FORCE_MUTEXES. * src/atomic_counter.hpp: (atomic_counter_t::add): (atomic_counter_t::sub): * src/atomic_ptr.hpp: (atomic_ptr_t::xchg): (atomic_ptr_t::cas): Use result of these checks. Preference order: 1. GCC-style __sync_*() builtins 2. Inline asm (x86, x86-64, armv7a) 3. Solaris/NetBSD-style atomic.h, Windows-specific API 4. Fallback to mutex-based implementation
2012-04-29atomic: prefer GCC __sync_*() builtins over inline asmAndrew W. Nosenko
Use GCC __sync_*() builtins when compiler claims to be GCC (GCC itself, Clang...) It can be disabled explicitly by using XS_DISABLE_GCC_SYNC_BUILTINS define. Just for any case. * src/atomic_counter.hpp [__GNUC__ && !XS_DISABLE_GCC_SYNC_BUILTINS]: (atomic_counter_t::add): (atomic_counter_t::sub): * src/atomic_ptr.hpp [__GNUC__ && !XS_DISABLE_GCC_SYNC_BUILTINS]: (atomic_ptr_t::xchg): (atomic_ptr_t::cas): Prefer GCC __sync_*() builtins over inline asm.
2012-04-29Implement atomic operations for armv7aPatrick Trantham
This commit implements atomic operations for the armv7a architecture using gcc inline assembly. This offers higher performance compared to pthread mutexes. Tested on an am3517 evm, clocked at 600MHz: ./inproc_thr 200 1000000 ------------------------ 53-60K messages / sec, pthread mutexes 73-90K messages / sec, assembly atomic ops ./inproc_lat 200 1000000 ------------------------ average latency: 42.234 [us], pthread mutexes average latency: 35.496 [us], assembly atomic ops
2012-04-29Fix a bug in prefix filter compaction logicAdam Guthrie
2012-04-27Replaced obsolete autoconf and automake macrosGabriele Svelto
This patch cleans up a number of obsolete constructs in the build system, these include: - Replacing AC_TRY_RUN with AC_RUN_IFELSE for the SOCK_CLOEXEC test - Using AC_CONFIG_HEADERS instead of AM_CONFIG_HEADER - Using LT_INIT with the win32-dll parameter instead of the obsolete AC_PROG_LIBTOOL and AC_LIBTOOL_WIN32_DLL macros - Removing the unused and obsolete AC_TYPE_SIGNAL check - Removing the unused alloca.h header check - Replacing the deprecated INCLUDES macro with AM_CPPFLAGS Signed-off-by: Gabriele Svelto <gabriele.svelto@gmail.com>
2012-04-27Truncate the message when it is sent to XSUBMartin Sustrik
This patch is based on patch by Martin Hurton from 0MQ project. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-04-25Solaris build fixedMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-04-25tcp_address_t and ipc_address_t merged into a single classMartin Sustrik
This patch is a preliminary work for mergine TCP and IPC connecters and listeners. The ultimated goal is to avoid code duplication occuring in these classes. 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-21Change the way the polling system is selectedGabriele Svelto
All polling systems are now checked and corresponding macros set accordingly (e.g. detection of a working poll() function will define XS_HAVE_POLL). Additionally if the user selects a specific polling system via the --with-poller switch a corresponding XS_FORCE_* macro will be defined. The select() and poll() tests now conditionally include headers which makes them more robust on various target platforms. Signed-off-by: Gabriele Svelto <gabriele.svelto@gmail.com>
2012-04-21Documentation for survey pattern addedMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-04-21Fix a warning in MSVC buildMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-04-21Minor typo in tests.cpp fixedMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-04-21xs_shutdown implementedMartin Sustrik
This patch allows for partial shutdown of the socket. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-04-20Footnotes in README fixedMartin Sustrik
It turns out the GitHub is not able to format Asciidoc footnotes. This patch handles the footnotes manually. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-04-20Clock instance removed from surveyor_tMartin Sustrik
SURVEYOR socket now uses clock instance from socket_base_t for measuring survey timeout. This allows for better performance in tight xs_recv() loops. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-04-18Adam Guthrie added to the AUTHORS fileMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-04-18xs_zmq: initialize size in zmq_getsockoptAdam Guthrie
This fixes a critical bug in zmq_getsockopt.
2012-04-18Improve efficiency of time measurement in tight loopsMartin Sustrik
This patch instantiate a clock_t instance for each XS socket. Thus, it is shared between subsequent calls to xs_recv (and xs_send). That in turn significantly limits the number of invocations of getimeofday (or similar) when timeouts are used and recv/send is called in a tight loop. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-04-18Test that old surveys are discardedMartin Sustrik
Improvement to the "survey" test Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-04-18Discard pending surveys when (X)SURVEYOR socket disappearsMartin Sustrik
This is an optimisation. The idea is that when surveyor disappears it makes no sense to process any surveys it have sent. There are two cases handled: - when (X)SURVEYOR socket is closed any unsent outbound messages are discarded - when (X)RESPONDENT detects that its peer have disconnected it drops any unprocessed messages that have been received from it Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-04-17Use AC_USE_SYSTEM_EXTENSIONS instead of OS-specific definesGabriele Svelto
Signed-off-by: Gabriele Svelto <gabriele.svelto@gmail.com>
2012-04-17XS_SURVEY_TIMEOUT socket option added.Martin Sustrik
It can be used to timeout the survey. Value is in milliseconds and -1 means infinite (default). Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-04-17"Survey" pattern implementedMartin Sustrik
Survey pattern is "multicast with reply". There are two roles: surveyor and respondent. Surveyor publishes a survey which gets delivered to all connected respondents. Each repondent can send a response to the survey. All the responses are delivered to the original surveyor. Once the surveyor decides that the survey is over (e.g. deadline was reached) it can send initiate survey. Late responses from old surveys are automatically discarded by the surveyor socket. Socket types: SURVEYOR, XSURVEYOR, RESPONDENT, XRESPONDENT Patch also includes a test program with surveoyr, two respondents and an intermediary device. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-04-17Got rid of <> characters in URLs.Gonzalo Diethelm
2012-04-16Few trivial fixes to REQ/REP pattern.Martin Sustrik
- couple of comments adjusted - empty 'stack delimiter' message correctly closed - non-reachable function xrep_t::rollback() removed Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-04-16Automotic loading of plugins (Linux)Martin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-04-16Define the XS_PREFIX_PATH macro with the installation prefixGabriele Svelto
Signed-off-by: Gabriele Svelto <gabriele.svelto@gmail.com>
2012-04-16Automatic loading of plugins on WindowsMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-04-16Improve POSIX threads detection and configurationGabriele Svelto
POSIX threads support is checked using the AX_PTHREAD macro, this provides improved support and coverage of different platforms. The M4 macros are also moved into the M4 directory. Signed-off-by: Gabriele Svelto <gabriele.svelto@gmail.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-15Fixed a warning in the timeo testGabriele Svelto
Fixed a couple of mixed signed/unsigned comparison which in conjunction with -Werror prevented compilation of the test. Signed-off-by: Gabriele Svelto <gabriele.svelto@gmail.com>
2012-04-15thread_t rewritten in C styleMartin Sustrik
thread_t is one of the classes where C++ syntax creates more problems then it solves. This patch converts it into simple C-style pseudo-class. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-04-15Filters can transform user subscriptions to wire subscriptionMartin Sustrik
Till now the subscription, as specified by the user, was send upstream. This patch allows SUB-side filter to transform the user subscription into wire subscription. For example, only a has can be sent upstream instead of a perfect subscription. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-04-15Minor improvement to error reportingMartin Sustrik
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-14Separate subscription forwarding from SUB-side filteringMartin Sustrik
- subscription forwarding is handled by XSUB socket - filtering is handled by SUB sockets - subscriptions are decoupled from filter engines - filter doesn't have to be able to enumarate the subscriptions (no sf_enumerate function) Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-04-14Define _GNU_SOURCE in addition to the __BSD_VISIBLE on freebsd-like hostsAndrew W. Nosenko
Define _GNU_SOURCE in addition to the __BSD_VISIBLE on the freebsd-like hosts. It made in hope to cover cases and obtain the full power of underlying kernel on "hybrid" systems like Debian GNU/kFreeBSD, when GLibc (or derived) library lives on top of FreeBSD kernel. On the "real" FreeBSD it only enables getline(3), and therefore, should not hurt. * configure.ac: Define _GNU_SOURCE in addition to the __BSD_VISIBLE for cover GLibc (or derived) on top of FreeBSD kernel cases, as it is in Debian GNU/kFreeBSD case.
2012-04-14Check for SO_NOSIGPIPE availability instead of OS nameAndrew W. Nosenko
* src/stream_engine.cpp (stream_engine_t::stream_engine_t): Use #ifdef SO_NOSIGPIPE instead of #if defined XS_HAVE_OSX || defined XS_HAVE_FREEBSD
2012-04-14If available, use MSG_NOSIGNAL for send()Martin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-04-14Checking for correct timeout in the test suite improvedMartin Sustrik
This patch introduces 1/2 second tolerance for the timeouts in the tests. This will hopefully make tests not fail even on slow or heavily loaded machines. 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-12Memory allocation bug fixed in prefix filterMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-04-12Accumulated cruft removed from prefix_filter_tMartin Sustrik
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-04-11HANDLE_FLAG_INHERIT is set to 0 on internal socketsMartin Sustrik
On Windows, HANDLE_FLAG_INHERIT is equivalent to O_CLOEXEC on UNIX. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
2012-04-11ETIMEDOUT is a valid error code here. Fixes intermittent assertion failure ↵Mikko Koppanen
on laggy networks