Merge pull request #112 from hintjens/master

Backported fix for libzmq-39
This commit is contained in:
Pieter Hintjens 2013-11-06 11:24:26 -08:00
commit f5bc82d9a4
2 changed files with 3 additions and 3 deletions

2
NEWS
View File

@ -1,6 +1,8 @@
0MQ version 3.2.5 stable, released on 2014/xx/xx
================================================
* LIBZMQ-39 Assertion failure "Bad file descriptor" during shutdown (rare)
0MQ version 3.2.4 stable, released on 2013/09/20
================================================

View File

@ -91,7 +91,6 @@ int zmq::ctx_t::terminate ()
// restarted.
bool restarted = terminating;
terminating = true;
slot_sync.unlock ();
// First attempt to terminate the context.
if (!restarted) {
@ -99,13 +98,12 @@ int zmq::ctx_t::terminate ()
// First send stop command to sockets so that any blocking calls
// can be interrupted. If there are no sockets we can ask reaper
// thread to stop.
slot_sync.lock ();
for (sockets_t::size_type i = 0; i != sockets.size (); i++)
sockets [i]->stop ();
if (sockets.empty ())
reaper->stop ();
slot_sync.unlock ();
}
slot_sync.unlock();
// Wait till reaper thread closes all the sockets.
command_t cmd;