[thread] is there an interestoin a static thread group?

Hi, The Boost.Thread library provides a thread_group class for a collection of threads that are related in some fashion. This collection is dynamic, i.e. we can add and remove threads to this collection. When this collection is known at the group creation and can not change a static thread group could be useful. This template class thread_tuple_n will have the same operations than a thread_group, join_all, interrupt_all and size and could be used as follows: void free_function() { // .... } class X { public: void mf() { // .... } }; class Y { public: void operator()() { // .... } }; X x; Y y; thread_tuple_3 tt(free_function, make_pair(&X::mf, x), y); // ... tt.interrupt_all(); // ... tt.join_all(); Best _____________________ Vicente Juan Botet Escriba

Hello, I have implemented a static_thread_group class which mimics the thread_group and allows in addition to join the first one. The main difference is that that the group is created at construction time. There is yet another differences, all the threads are created by the static_thread_group. I have implemented also two functions free join_all and join_first_then_interrupt. One of the advantages is that no extra heap allocation is needed. I have attached the file and some tests. I want also to implement a make_static_thread_group, but we need then to make static_thread_group movable. Any thoughts? Vicente ----- Original Message ----- From: "vicente.botet" <vicente.botet@wanadoo.fr> To: <boost@lists.boost.org> Sent: Sunday, April 27, 2008 7:27 PM Subject: [boost] [thread] is there an interestoin a static thread group?
Hi,
The Boost.Thread library provides a thread_group class for a collection of threads that are related in some fashion. This collection is dynamic, i.e. we can add and remove threads to this collection. When this collection is known at the group creation and can not change a static thread group could be useful.
This template class thread_tuple_n will have the same operations than a thread_group, join_all, interrupt_all and size and could be used as follows:
void free_function() { // .... }
class X { public: void mf() { // .... } };
class Y { public: void operator()() { // .... } };
X x;
Y y;
thread_tuple_3 tt(free_function, make_pair(&X::mf, x), y); // ... tt.interrupt_all(); // ... tt.join_all();
Best
_____________________ Vicente Juan Botet Escriba _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
participants (1)
-
vicente.botet