Boost C++ Libraries: Ticket #3735: thread_group::interrupt_all() is unreliable https://svn.boost.org/trac10/ticket/3735 <p> 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. </p> <p> 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. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3735 Trac 1.4.3 stoney@… Tue, 08 Dec 2009 17:48:41 GMT attachment set https://svn.boost.org/trac10/ticket/3735 https://svn.boost.org/trac10/ticket/3735 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">ThreadInterruptFail.zip</span> </li> </ul> <p> XCode project with 1 source file that demonstrates the thread_group::interrupt_all() failure </p> Ticket Paul Pogonyshev <pogonyshev@…> Sun, 27 Dec 2009 18:23:45 GMT severity changed https://svn.boost.org/trac10/ticket/3735#comment:1 https://svn.boost.org/trac10/ticket/3735#comment:1 <ul> <li><strong>severity</strong> <span class="trac-field-old">Problem</span> → <span class="trac-field-new">Showstopper</span> </li> </ul> <p> See also <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/2330" title="#2330: Patches: thread::interrupt() can be lost if condition_variable::wait() in progress (closed: fixed)">ticket:2330</a> (don't seem to be able to mark as duplicate here). </p> <p> This is not merely a problem. This is a showstopper, because it renders interrupt_all() worse than not present: unless you know of this workaround, you can introduce a bug into your problem that is very close to track down and can lead to data loss (full lockdown). </p> Ticket viboes Fri, 21 May 2010 16:18:56 GMT <link>https://svn.boost.org/trac10/ticket/3735#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3735#comment:2</guid> <description> <p> See my comment on <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3960" title="#3960: Bugs: condition_variable::timed_wait() cannot be interrupted (closed: duplicate)">#3960</a> condition_variable::timed_wait() cannot be interrupted. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Anthony Williams</dc:creator> <pubDate>Mon, 07 Jun 2010 08:08:46 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/3735#comment:3 https://svn.boost.org/trac10/ticket/3735#comment:3 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">duplicate</span> </li> </ul> <p> Duplicate of 2330 </p> Ticket