Boost logo

Boost Users :

Subject: Re: [Boost-users] [thread] Is a call to interrupt_all blocking?
From: Roland Bock (rbock_at_[hidden])
Date: 2010-01-26 12:29:14


Geoff Shapiro wrote:
> Anthony Williams <anthony.ajw <at> gmail.com> writes:
>
>> interrupt_all is not blocking. However, there is currently a bug in
>> interruption on pthreads which means threads can miss interruptions
>> if they get a spurious condition variable wake at the wrong time.
>> Since interruption causes spurious wakes for other threads waiting on
>> the same cv this is particularly a problem for interrupt_all.
>
> Anthony, what is the schedule, if any, for getting a fix for the bug
> you refer to? The project I am currently working on, in development
> within a win32 environment, but soon to be ported to a VxWorks/PPC
> (using pthreads) environment does use interruption facilities. If this
> will be a problem for us, let's say not fixed up within the next 6 months,
> then I'll have to utilize alternate schemes.
>
> Geoff Shapiro
> FLIR Systems, Inc.

There was a discussion about this topic a few weeks ago, e.g.:
http://lists.boost.org/boost-users/2009/12/54165.php

If I got it right, a workaround is

{
    boost::mutex::scoped_lock lock(mutex_); // lock the mutex of the cv
    threadGroup_.interrupt_all();
} // unlock the mutex

HTH,

Roland


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net