Merge pull request #398 from hurtonm/master

Rewrite event processing in io_thread
This commit is contained in:
Ian Barber 2012-07-06 10:50:00 -07:00
commit f8752bf9fc

View File

@ -67,20 +67,16 @@ void zmq::io_thread_t::in_event ()
// TODO: Do we want to limit number of commands I/O thread can
// 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;
int rc = mailbox.recv (&cmd, 0);
if (rc != 0 && errno == EINTR)
continue;
if (rc != 0 && errno == EAGAIN)
break;
errno_assert (rc == 0);
// Process the command.
cmd.destination->process_command (cmd);
while (rc == 0 || errno == EINTR) {
if (rc == 0)
cmd.destination->process_command (cmd);
rc = mailbox.recv (&cmd, 0);
}
errno_assert (rc != 0 && errno == EAGAIN);
}
void zmq::io_thread_t::out_event ()