[Boost-users] empty a thread_group

42 views
Skip to first unread message

Axel

unread,
Apr 15, 2008, 10:52:10 AM4/15/08
to boost...@lists.boost.org
Hello

I m using a boost::thread_group instance to handle a limited number of
threads. When the thread_group reach a defined size, I cal join_all() on
it and I wonder how I could clear it without having to keep a pointer to
its threads and call remove_thread() for each one. I thought about
destruct th thread_group instance but I m not sure it's a good idea, so
any advice is welcome.

Regards
Axel
_______________________________________________
Boost-users mailing list
Boost...@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users

Anthony Williams

unread,
Apr 16, 2008, 5:43:18 AM4/16/08
to boost...@lists.boost.org
Axel <axel....@laposte.net> writes:

> I m using a boost::thread_group instance to handle a limited number of
> threads. When the thread_group reach a defined size, I cal join_all() on
> it and I wonder how I could clear it without having to keep a pointer to
> its threads and call remove_thread() for each one. I thought about
> destruct th thread_group instance but I m not sure it's a good idea, so
> any advice is welcome.

You're right that there is not currently a way to do this, other than keep
track of all the threads in the thread group separately, and then remove
them. It might be worth extending thread_group to handle this.

Anthony
--
Anthony Williams | Just Software Solutions Ltd
Custom Software Development | http://www.justsoftwaresolutions.co.uk
Registered in England, Company Number 5478976.
Registered Office: 15 Carrallack Mews, St Just, Cornwall, TR19 7UL

Reply all
Reply to author
Forward
0 new messages