开发者

boost thread, test if thread is ready to join

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜