From 235ed3a3dcffb7c658cbc9253eae9de54db24533 Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Tue, 4 May 2010 10:22:16 +0200 Subject: signaler transports commands per se rather than one-bit signals --- src/signaler.hpp | 45 +++++++++++++-------------------------------- 1 file changed, 13 insertions(+), 32 deletions(-) (limited to 'src/signaler.hpp') diff --git a/src/signaler.hpp b/src/signaler.hpp index 5509894..64a1899 100644 --- a/src/signaler.hpp +++ b/src/signaler.hpp @@ -26,15 +26,11 @@ #include "fd.hpp" #include "stdint.hpp" #include "config.hpp" +#include "command.hpp" namespace zmq { - // This object can be used to send individual signals from one thread to - // another. The specific of this pipe is that it has associated file - // descriptor and so it can be polled on. Same signal cannot be sent twice - // unless signals are retrieved by the reader side in the meantime. - class signaler_t { public: @@ -42,44 +38,29 @@ namespace zmq signaler_t (); ~signaler_t (); - static const uint32_t no_signal; - - void signal (uint32_t signal_); - uint32_t poll (); - uint32_t check (); fd_t get_fd (); - + void send (const command_t &cmd_); + bool recv (command_t *cmd_, bool block_); + private: - void xpoll (); - void xcheck (); - #if defined ZMQ_HAVE_OPENVMS - // Whilst OpenVMS supports socketpair - it maps to AF_INET only. - // Further, it does not set the socket options TCP_NODELAY and - // TCP_NODELACK which can lead to performance problems. We'll - // overload the socketpair function for this class. - // - // The bug will be fixed in V5.6 ECO4 and beyond. In the - // meantime, we'll create the socket pair manually. - static int socketpair (int domain_, int type_, int protocol_, - int sv_ [2]); + // Whilst OpenVMS supports socketpair - it maps to AF_INET only. + // Further, it does not set the socket options TCP_NODELAY and + // TCP_NODELACK which can lead to performance problems. We'll + // overload the socketpair function for this class. + // + // The bug will be fixed in V5.6 ECO4 and beyond. In the + // meantime, we'll create the socket pair manually. + static int socketpair (int domain_, int type_, int protocol_, + int sv_ [2]); #endif // Write & read end of the socketpair. 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