Subject: [Boost-bugs] [Boost C++ Libraries] #3735: thread_group::interrupt_all() is unreliable
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-12-08 17:47:12
#3735: thread_group::interrupt_all() is unreliable
-----------------------------------------+----------------------------------
Reporter: stoney@⦠| Owner: anthonyw
Type: Bugs | Status: new
Milestone: Boost 1.42.0 | Component: thread
Version: Boost 1.41.0 | Severity: Problem
Keywords: thread mutex interrupt race |
-----------------------------------------+----------------------------------
In boost 1_41_0, thread_group::interrupt_all() occasionally fails to
interrupt some threads due to a race condition when the threads are
waiting on a condition_variable. The solution seems to be to have the
interrupter lock the condition_variable's mutex before calling
thread::interrupt(). While the fundamental problem is in
thread::interrupt(), thread_group::interrupt_all() is a good way to expose
the problem, since it happens only when multiple threads waiting on the
same condition_variable are being interrupted in quick succession.
A workaround is to have the object owning the condition_variable lock the
associated mutex before calling thread_group::interrupt_all(). The
attached example demonstrates both the problem and the workaround.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/3735> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:02 UTC