Boost logo

Boost Users :

Subject: Re: [Boost-users] [Thread] join_all and interrupt_all playing together
From: Anthony Williams (anthony.ajw_at_[hidden])
Date: 2009-10-22 03:59:34


Ryan McConnehey <mccorywork_at_[hidden]> writes:

> I'm trying to set several threads running and have the main thread
> signal an interrupt. I've included an example that shows what I'm
> trying to accomplish. The threads that are created are associated
> with thread_group and then a join_all is called. I would expect the
> main thread to be able to call interrupt_all on the thread_group.
> Since this wasn't working I looked at what the join_all and
> interrupt_all function were actually doing. It turns out that
> thread_group has a mutex that is being called for each function and
> since the mutex for join_all is in use, the lock in interrupt_all is
> blocking. I understand why the mutex is there but am unclear how
> interrupt_all is suppose to work with join_all. To accomplish the
> functionality I need I have to use create_thread and store the return
> pointer in a list of my own. Then call interrupt on each pointer I
> stored. Which is basically duplicating the storage of thread_group.
> This seem like a waste. I would appreciate any advice.

There's an open trac issue about it. I'm working on boost::thread today,
so I'll apply the patch.

Anthony

-- 
Author of C++ Concurrency in Action | http://www.manning.com/williams
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