Commit 12442a3d authored by Richard Newton's avatar Richard Newton

Bind pending connections on terminate outside lock.

parent 668c42fc
...@@ -95,6 +95,14 @@ zmq::ctx_t::~ctx_t () ...@@ -95,6 +95,14 @@ zmq::ctx_t::~ctx_t ()
int zmq::ctx_t::terminate () int zmq::ctx_t::terminate ()
{ {
// Connect up any pending inproc connections, otherwise we will hang
pending_connections_t copy = pending_connections;
for (pending_connections_t::iterator p = copy.begin (); p != copy.end (); ++p) {
zmq::socket_base_t *s = create_socket (ZMQ_PAIR);
s->bind (p->first.c_str ());
s->close ();
}
slot_sync.lock (); slot_sync.lock ();
if (!starting) { if (!starting) {
...@@ -108,13 +116,6 @@ int zmq::ctx_t::terminate () ...@@ -108,13 +116,6 @@ int zmq::ctx_t::terminate ()
term_mailbox.forked(); term_mailbox.forked();
} }
#endif #endif
// Connect up any pending inproc connections, otherwise we will hang
pending_connections_t copy = pending_connections;
for (pending_connections_t::iterator p = copy.begin (); p != copy.end (); ++p) {
zmq::socket_base_t *s = create_socket (ZMQ_PAIR);
s->bind (p->first.c_str ());
s->close ();
}
// Check whether termination was already underway, but interrupted and now // Check whether termination was already underway, but interrupted and now
// restarted. // restarted.
......
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