mirror of
https://github.com/zeromq/libzmq.git
synced 2025-10-29 20:59:47 +01:00
Problem: in case of exhausted resources on creation of a context, assertions are triggered
Solution: signal error to caller, and apply appropriate cleanup
This commit is contained in:
@@ -37,13 +37,16 @@
|
||||
#include "ctx.hpp"
|
||||
|
||||
zmq::io_thread_t::io_thread_t (ctx_t *ctx_, uint32_t tid_) :
|
||||
object_t (ctx_, tid_)
|
||||
object_t (ctx_, tid_),
|
||||
mailbox_handle (NULL)
|
||||
{
|
||||
poller = new (std::nothrow) poller_t (*ctx_);
|
||||
alloc_assert (poller);
|
||||
|
||||
mailbox_handle = poller->add_fd (mailbox.get_fd (), this);
|
||||
poller->set_pollin (mailbox_handle);
|
||||
if (mailbox.get_fd () != retired_fd) {
|
||||
mailbox_handle = poller->add_fd (mailbox.get_fd (), this);
|
||||
poller->set_pollin (mailbox_handle);
|
||||
}
|
||||
}
|
||||
|
||||
zmq::io_thread_t::~io_thread_t ()
|
||||
@@ -109,6 +112,8 @@ zmq::poller_t *zmq::io_thread_t::get_poller ()
|
||||
|
||||
void zmq::io_thread_t::process_stop ()
|
||||
{
|
||||
poller->rm_fd (mailbox_handle);
|
||||
if (mailbox_handle) {
|
||||
poller->rm_fd (mailbox_handle);
|
||||
}
|
||||
poller->stop ();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user