Commit 938689a4 authored by Martin Sustrik's avatar Martin Sustrik

synchronisation problem fixed in ctx_t

parent 471013a5
...@@ -108,8 +108,10 @@ int zmq::ctx_t::terminate () ...@@ -108,8 +108,10 @@ int zmq::ctx_t::terminate ()
{ {
// First send stop command to sockets so that any // First send stop command to sockets so that any
// blocking calls are interrupted. // blocking calls are interrupted.
slot_sync.lock ();
for (sockets_t::size_type i = 0; i != sockets.size (); i++) for (sockets_t::size_type i = 0; i != sockets.size (); i++)
sockets [i]->stop (); sockets [i]->stop ();
slot_sync.unlock ();
// Close the logging infrastructure. // Close the logging infrastructure.
log_sync.lock (); log_sync.lock ();
......
...@@ -139,7 +139,10 @@ void zmq::zmq_init_t::finalise_initialisation () ...@@ -139,7 +139,10 @@ void zmq::zmq_init_t::finalise_initialisation ()
if (sent && received) { if (sent && received) {
// If we know what session we belong to, it's easy, just send the // If we know what session we belong to, it's easy, just send the
// engine to that session and destroy the init object. // engine to that session and destroy the init object. Note that we
// know about the session only if this object is owned by it. Thus,
// lifetime of this object in contained in the lifetime of the session
// so the pointer cannot become invalid without notice.
if (session) { if (session) {
engine->unplug (); engine->unplug ();
send_attach (session, engine, peer_identity, true); send_attach (session, engine, peer_identity, true);
......
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