中断任意等待操作
Interrupt an arbitrary wait operation
在Boost.Thread中,我们有boost::thread::interrupt. However, its usage is very limited. In particular, it only applies to the wait operations as listed here. So, for example, a common mutex::lock
operation cannot be interrupted using this method. Does Boost support no full-range interruption capabilities, and there is no way to interrupt a mutex::lock
operation? I know that, in Windows API, any wait operation can be easily interrupted using the alertable wait functions.
你是正确的,boost::thread::interrupt
是有限的,事实上在 C++11 中根本没有提升到 std::thread
。建议使用条件变量。
在Boost.Thread中,我们有boost::thread::interrupt. However, its usage is very limited. In particular, it only applies to the wait operations as listed here. So, for example, a common mutex::lock
operation cannot be interrupted using this method. Does Boost support no full-range interruption capabilities, and there is no way to interrupt a mutex::lock
operation? I know that, in Windows API, any wait operation can be easily interrupted using the alertable wait functions.
你是正确的,boost::thread::interrupt
是有限的,事实上在 C++11 中根本没有提升到 std::thread
。建议使用条件变量。