summaryrefslogtreecommitdiff
path: root/src/ctx.cpp
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2012-02-16 10:03:57 +0900
committerMartin Sustrik <sustrik@250bpm.com>2012-02-16 10:03:57 +0900
commit3256318a4a118d7658c1a7d26cb8af31af395289 (patch)
tree780fbf2f137a773993e9a6d52c153ba51084a3dc /src/ctx.cpp
parent9a17a34ce4904f3f55e329f8ff0c4afe239602a0 (diff)
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 <sustrik@250bpm.com>
Diffstat (limited to 'src/ctx.cpp')
-rw-r--r--src/ctx.cpp2
1 files changed, 1 insertions, 1 deletions
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 ())