Work around for LIBZMQ-496

The problem is that other threads might still be in mailbox::send() when
it is destroyed. So as a workaround, we just acquire the mutex in the
destructor. Therefore the running send will finish before the mailbox is
destroyed.

See also the fix for LIBZMQ-281 in zeromq2-x.

Signed-off-by: Mika Fischer <mika.fischer@zoopnet.de>
This commit is contained in:
Mika Fischer 2013-02-19 11:01:13 +01:00
parent 3b132e337e
commit 03c28411d8

View File

@ -33,6 +33,11 @@ zmq::mailbox_t::mailbox_t ()
zmq::mailbox_t::~mailbox_t ()
{
// TODO: Retrieve and deallocate commands inside the cpipe.
// Work around problem that other threads might still be in our
// send() method, by waiting on the mutex before disappearing.
sync.lock ();
sync.unlock ();
}
zmq::fd_t zmq::mailbox_t::get_fd ()