How can I tell reliably if a boost thread has exited its run method?

后端 未结 7 1021
情歌与酒
情歌与酒 2020-12-01 13:40

I assumed joinable would indicate this, however, it does not seem to be the case.

In a worker class, I was trying to indicate that it was still processing through a

7条回答
  •  粉色の甜心
    2020-12-01 14:28

    I am using boost 1.54, by which stage timed_join() is being deprecated. Depending upon your usage, you could use joinable() which works perfectly for my purposes, or alternatively you could use try_join_for() or try_join_until(), see:

    http://www.boost.org/doc/libs/1_54_0/doc/html/thread/thread_management.html

提交回复
热议问题