
Hello. I have following small program (pseudocode): void Read() { do { // ... } while (...); } // Read() void Write() { do { // ... } while (...); } // Write() boost::thread thrd1(Read); boost::thread thrd2(Write); // I don't want the following thrd1.join(); thrd2.join(); No, I want to stop when either thread finishes something like a join_any(). Does that exist? greetings Chris } while (...); } // Write() boost::thread thrd1(Read); boost::thread thrd2(Write); // I don't want the following thrd1.join(); thrd2.join(); No, I want to stop when either thread finishes something like a conditional join. Does that exist? greetings Chris

At Mon, 22 Nov 2010 16:12:22 -0800 (PST), Chris wrote:
No, I want to stop when either thread finishes something like a join_any(). Does that exist?
greetings Chris
} while (...); } // Write()
boost::thread thrd1(Read); boost::thread thrd2(Write);
// I don't want the following thrd1.join(); thrd2.join();
No, I want to stop when either thread finishes something like a conditional join. Does that exist?
Sounds like a job for condition variables. -- Dave Abrahams BoostPro Computing http://www.boostpro.com

Hello.
condition variables OK but then my actual problem is that the Read-
function is already waiting for
data to arrive using a condition variable something like:
void Read()
{
bool end_loop = false;
do
{
scoped_lock
At Mon, 22 Nov 2010 16:12:22 -0800 (PST),
Chris wrote:
No, I want to stop when either thread finishes something like a join_any(). Does that exist?
greetings Chris
} while (...); } // Write()
boost::thread thrd1(Read); boost::thread thrd2(Write);
// I don't want the following thrd1.join(); thrd2.join();
No, I want to stop when either thread finishes something like a conditional join. Does that exist?
Sounds like a job for condition variables.
-- Dave Abrahams BoostPro Computinghttp://www.boostpro.com
_______________________________________________ Boost-users mailing list Boost-us...@lists.boost.orghttp://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Chris
-
David Abrahams