|
Boost Users : |
Subject: Re: [Boost-users] [thread] Is a call to interrupt_all blocking?
From: Anthony Williams (anthony.ajw_at_[hidden])
Date: 2010-01-27 09:55:14
Sachin Garg <schngrg_at_[hidden]> writes:
> On Tue, Jan 26, 2010 at 4:22 PM, Anthony Williams <anthony.ajw_at_[hidden]> wrote:
>> Sachin Garg <schngrg_at_[hidden]> writes:
>>
>> > Does a call to interrupt_all blocks the calling thread, waiting for all threads
>> > to be interrupted? Or is it supposed to return immediately and let the threads
>> > hit their interruption points later?
>>
>> interrupt_all is not blocking.
>
> My blocking problem seems to be because I am calling interrupt_all
> when another thread is already waiting on a join_all for same
> thread_group. Similar to the issue described in the post below. I am
> using boost 1.39.0, is this fixed in current 1.41.0?
>
> http://lists.boost.org/boost-users/2009/10/53107.php
Yes.
>> 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.
>
> I think I can live with this bug for a while :-) let me know if I am
> misunderstanding it.
>
> The condition variable bug *seems* to mean that in worst case a thread
> a may miss one interruption point and then get interrupted at its next
> interruption point (the interruption is not lost, just delayed)
Yes, that's right. The problem is that the interrupted thread may miss
the interruption, and thus remain waiting on the CV. If the CV is
subsequently signalled or broadcast then the thread will wake and see
the interruption.
> Is the fix for this expected in 1.42.0? 1.42.0 release seems to be
> very close. Anyway, if my understanding of bug is correct, I can live
> with it for a while.
V1.42 is indeed very close. This bug was marked as a showstopper in
trac. If anyone thinks it is a showstopper for them, reply to Marshall's
post on the boost devel list to say so and I'll try and get the fix done
for 1.42. Otherwise it will have to wait for 1.43.
Anthony
-- Author of C++ Concurrency in Action http://www.stdthread.co.uk/book/ just::thread C++0x thread library http://www.stdthread.co.uk Just Software Solutions Ltd http://www.justsoftwaresolutions.co.uk 15 Carrallack Mews, St Just, Cornwall, TR19 7UL, UK. Company No. 5478976
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