Commit e37814ec authored by Martin Hurton's avatar Martin Hurton

Rewrite event processing in io_thread

parent 823d14c7
...@@ -67,20 +67,16 @@ void zmq::io_thread_t::in_event () ...@@ -67,20 +67,16 @@ void zmq::io_thread_t::in_event ()
// TODO: Do we want to limit number of commands I/O thread can // TODO: Do we want to limit number of commands I/O thread can
// process in a single go? // process in a single go?
while (true) { command_t cmd;
int rc = mailbox.recv (&cmd, 0);
// Get the next command. If there is none, exit.
command_t cmd; while (rc == 0 || errno == EINTR) {
int rc = mailbox.recv (&cmd, 0); if (rc == 0)
if (rc != 0 && errno == EINTR) cmd.destination->process_command (cmd);
continue; rc = mailbox.recv (&cmd, 0);
if (rc != 0 && errno == EAGAIN)
break;
errno_assert (rc == 0);
// Process the command.
cmd.destination->process_command (cmd);
} }
errno_assert (rc != 0 && errno == EAGAIN);
} }
void zmq::io_thread_t::out_event () void zmq::io_thread_t::out_event ()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment