Sachin Garg
On Tue, Jan 26, 2010 at 4:22 PM, Anthony Williams
wrote: Sachin Garg
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?
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