From 3256318a4a118d7658c1a7d26cb8af31af395289 Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Thu, 16 Feb 2012 10:03:57 +0900 Subject: Race condition in zmq_term() fixed It was possible to open a new socket while the log socket was being shut down. Signed-off-by: Martin Sustrik --- src/ctx.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ctx.cpp b/src/ctx.cpp index 2beda82..df1019b 100644 --- a/src/ctx.cpp +++ b/src/ctx.cpp @@ -130,6 +130,7 @@ int xs::ctx_t::terminate () // restarted. slot_sync.lock (); bool restarted = terminating; + terminating = true; slot_sync.unlock (); // First attempt to terminate the context. @@ -153,7 +154,6 @@ int xs::ctx_t::terminate () // can be interrupted. If there are no sockets we can ask reaper // thread to stop. slot_sync.lock (); - terminating = true; for (sockets_t::size_type i = 0; i != sockets.size (); i++) sockets [i]->stop (); if (sockets.empty ()) -- cgit v1.2.3