简体   繁体   中英

boost thread and process cleanup on windows

In my program I have a static object that creates a boost::thread. The thread is supposed to run until program termination, but it shouldn't be terminated in random state, so I implemented controled thread termination in this static object's destructor. The problem is that when main() terminates my thread is terminated before the destructor is called.

Now the question: is it possible to prevent the thread to be destroyed? Or at least delay it, so that it happens after the destructor is called?

将终结点从析构函数移动到函数,然后在main结束之前简单地调用它。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM