I would like to know if th开发者_StackOverflowere 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?
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.
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.
精彩评论