Boost logo

Boost :

From: Eric Woodruff (Eric.Woodruff_at_[hidden])
Date: 2002-09-05 13:54:35


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
}


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk