From ae93ed318a450d6d763a5f629d478467f7362b07 Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Thu, 29 Apr 2010 20:34:48 +0200 Subject: signaler rewritten in such a way that any number (>64) of threads can be used --- src/signaler.hpp | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'src/signaler.hpp') diff --git a/src/signaler.hpp b/src/signaler.hpp index f239771..5509894 100644 --- a/src/signaler.hpp +++ b/src/signaler.hpp @@ -20,9 +20,12 @@ #ifndef __ZMQ_SIGNALER_HPP_INCLUDED__ #define __ZMQ_SIGNALER_HPP_INCLUDED__ +#include + #include "platform.hpp" #include "fd.hpp" #include "stdint.hpp" +#include "config.hpp" namespace zmq { @@ -39,14 +42,18 @@ namespace zmq signaler_t (); ~signaler_t (); - // i_signaler interface implementation. - void signal (int signal_); - uint64_t poll (); - uint64_t check (); + static const uint32_t no_signal; + + void signal (uint32_t signal_); + uint32_t poll (); + uint32_t check (); fd_t get_fd (); private: + void xpoll (); + void xcheck (); + #if defined ZMQ_HAVE_OPENVMS // Whilst OpenVMS supports socketpair - it maps to AF_INET only. @@ -64,6 +71,15 @@ namespace zmq fd_t w; fd_t r; + // Signal buffer. + uint32_t buffer [signal_buffer_size]; + + // Position of the next signal in the buffer to return to the user. + size_t current; + + // Number of signals in the signal buffer. + size_t count; + // Disable copying of fd_signeler object. signaler_t (const signaler_t&); void operator = (const signaler_t&); -- cgit v1.2.3