diff options
author | Martin Sustrik <sustrik@250bpm.com> | 2012-04-14 10:08:19 +0200 |
---|---|---|
committer | Martin Sustrik <sustrik@250bpm.com> | 2012-04-15 06:55:29 +0200 |
commit | ee66c579dedf7130aa4d59afbf373f28c98eead5 (patch) | |
tree | 2b29d8e236b02789877da88ecf05d5b463c046da /src/reaper.cpp | |
parent | 19894e0a1b6fbbcb62028fc6513ef3904a6f5c76 (diff) |
Report EMFILE/ENFILE from xs_socket()
This patch propoagates the error from signaler and mailbox
initialisation up the stack.
To achieve this signaler and mailbox classes were re-written
is C-like syntax.
Finally, shutdown_stress test now ignores EMFILE/ENFILE errors.
Thus, the tests should pass even on OSX which sets the max
number of file descriptors pretty low by default.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
Diffstat (limited to 'src/reaper.cpp')
-rw-r--r-- | src/reaper.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/reaper.cpp b/src/reaper.cpp index b610151..52b3e2d 100644 --- a/src/reaper.cpp +++ b/src/reaper.cpp @@ -27,16 +27,20 @@ xs::reaper_t::reaper_t (class ctx_t *ctx_, uint32_t tid_) : sockets (0), terminating (false) { + int rc = mailbox_init (&mailbox); + errno_assert (rc == 0); + io_thread = io_thread_t::create (ctx_, tid_); xs_assert (io_thread); - mailbox_handle = io_thread->add_fd (mailbox.get_fd (), this); + mailbox_handle = io_thread->add_fd (mailbox_fd (&mailbox), this); io_thread->set_pollin (mailbox_handle); } xs::reaper_t::~reaper_t () { delete io_thread; + mailbox_close (&mailbox); } xs::mailbox_t *xs::reaper_t::get_mailbox () @@ -61,7 +65,7 @@ void xs::reaper_t::in_event (fd_t fd_) // Get the next command. If there is none, exit. command_t cmd; - int rc = mailbox.recv (&cmd, 0); + int rc = mailbox_recv (&mailbox, &cmd, 0); if (rc != 0 && errno == EINTR) continue; if (rc != 0 && errno == EAGAIN) |