中断任意等待操作

时间:2015-04-01 13:16:09

标签: c++ multithreading boost wait

Boost.Thread 中,我们有boost::thread::interrupt。但是,它的使用非常有限。特别是,它仅适用于列出here的等待操作。因此,例如,使用此方法无法中断常见的mutex::lock操作。 Boost是否支持没有全范围中断功能,并且无法中断mutex::lock操作?我知道,在Windows API中,任何等待操作都可以使用alertable wait functions轻松中断。

1 个答案:

答案 0 :(得分:1)

{I} boost::thread::interrupt是有限的,实际上在C ++ 11中根本没有提升为std::thread。建议使用条件变量。