views:

148

answers:

2

hi.

I would like to know if there is a way to test whenever thread finished execution and is waiting for joining. My guess was the use time_join. is there explicit way to test it?

+3  A: 

There's no API for that in boost::thread. I think the reason is that a thread can be detached and made not-joinable. Your best recourse is probably a wrapper and a flag.

Nikolai N Fetissov
+1  A: 

timed_join with a duration of 0 can be seen as a try_join, so yes you can test if a thread has been finish. I think that there is already a feature request to add this try_join function to Boost.Thread.

Vicente Botet Escriba