|
Boost : |
From: Eric Woodruff (Eric.Woodruff_at_[hidden])
Date: 2002-09-05 18:23:51
Stronger:
Create a wait_all_thread_pool and a wait_one_thread_pool, each is created
with the & and | operators respectively:
try {
(thread1 & thread2 & thead3).join (); // wait all
(thread5 | thread6).join () // wait for one of them
}
catch (...) {
}
----- Original Message -----
From: Eric Woodruff
Newsgroups: gmane.comp.lib.boost.devel
Sent: Thursday, 2002:September:05 14:54
Subject: Boost.Threads - ThreadPool
The following does not work as some may hope:
try {
result = thread1.join () + thread2.join () + thread3.join ();
}
catch (exception) {
}
because exceptions are thrown until join is called, which means if thread1
has an exception, the results of thread2 and thread3 must come back before
the exception is thrown.
Can we have a way to wait for a single thread to join in the pool? A
convenient way to make this pool could be with operator | like:
try {
(thread1 | thread2 | thread3).join_first (); // implicit threadpool,
throws on join_first ()
result = thread1.join () + thread2.join () + thread3.join ();
}
catch (exception) {
// sometimes an exception situation means it's not necessary to wait for
the others to finish
}
_______________________________________________
Unsubscribe & other changes:
http://lists.boost.org/mailman/listinfo.cgi/boost
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk