diff options
Diffstat (limited to 'src/io_thread.cpp')
| -rw-r--r-- | src/io_thread.cpp | 30 | 
1 files changed, 13 insertions, 17 deletions
| diff --git a/src/io_thread.cpp b/src/io_thread.cpp index 7d997ad..e9f9aa5 100644 --- a/src/io_thread.cpp +++ b/src/io_thread.cpp @@ -28,7 +28,8 @@  #include "command.hpp"  #include "dispatcher.hpp" -zmq::io_thread_t::io_thread_t (dispatcher_t *dispatcher_, int thread_slot_) : +zmq::io_thread_t::io_thread_t (dispatcher_t *dispatcher_, +      uint32_t thread_slot_) :      object_t (dispatcher_, thread_slot_)  {      poller = new (std::nothrow) poller_t; @@ -66,22 +67,17 @@ int zmq::io_thread_t::get_load ()  void zmq::io_thread_t::in_event ()  { -    //  Find out which threads are sending us commands. -    uint64_t signals = signaler.check (); -    zmq_assert (signals); - -    //  Iterate through all the threads in the process and find out -    //  which of them sent us commands. -    int slot_count = thread_slot_count (); -    for (int source_thread_slot = 0; -          source_thread_slot != slot_count; source_thread_slot++) { -        if (signals & (uint64_t (1) << source_thread_slot)) { - -            //  Read all the commands from particular thread. -            command_t cmd; -            while (dispatcher->read (source_thread_slot, thread_slot, &cmd)) -                cmd.destination->process_command (cmd); -        } +    while (true) { + +        //  Get the next signal. +        uint32_t signal = signaler.check (); +        if (signal == signaler_t::no_signal) +            break; + +        //  Process all the commands from the thread that sent the signal. +        command_t cmd; +        while (dispatcher->read (signal, thread_slot, &cmd)) +            cmd.destination->process_command (cmd);      }  } | 
