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/dispatcher.hpp | 30 ++++++++---------------------- 1 file changed, 8 insertions(+), 22 deletions(-) (limited to 'src/dispatcher.hpp') diff --git a/src/dispatcher.hpp b/src/dispatcher.hpp index 0a1ed5c..0986e8a 100644 --- a/src/dispatcher.hpp +++ b/src/dispatcher.hpp @@ -27,7 +27,6 @@ #include "signaler.hpp" #include "ypipe.hpp" -#include "command.hpp" #include "config.hpp" #include "mutex.hpp" #include "stdint.hpp" @@ -69,19 +68,12 @@ namespace zmq // should disassociate the object from the current OS thread. void no_sockets (class app_thread_t *thread_); - // Returns number of thread slots in the dispatcher. To be used by - // individual threads to find out how many distinct signals can be - // received. - uint32_t thread_slot_count (); + // Send command to the destination thread. + void send_command (uint32_t destination_, const command_t &command_); - // Send command from the source to the destination. - void write (uint32_t source_, uint32_t destination_, - const command_t &command_); - - // Receive command from the source. Returns false if there is no - // command available. - bool read (uint32_t source_, uint32_t destination_, - command_t *command_); + // Receive command from another thread. + bool recv_command (uint32_t thread_slot_, command_t *command_, + bool block_); // Returns the I/O thread that is the least busy at the moment. // Taskset specifies which I/O threads are eligible (0 = all). @@ -126,15 +118,9 @@ namespace zmq typedef std::vector io_threads_t; io_threads_t io_threads; - // Signalers for both application and I/O threads. - std::vector signalers; - - // Pipe to hold the commands. - typedef ypipe_t command_pipe_t; - - // NxN matrix of command pipes. - command_pipe_t *command_pipes; + // Array of pointers to signalers for both application and I/O threads. + int signalers_count; + signaler_t **signalers; // As pipes may reside in orphaned state in particular moments // of the pipe shutdown process, i.e. neither pipe reader nor -- cgit v1.2.3