boost / thread / pthread / shared_mutex.hpp包含以下代码:
...
#include <boost/thread/detail/thread_interruption.hpp>
...
class shared_mutex
{
...
void lock_shared()
{
boost::this_thread::disable_interruption do_not_disturb;
boost::mutex::scoped_lock lk(state_change);
while(state.exclusive || state.exclusive_waiting_blocked)
{
shared_cond.wait(lk);
}
++state.shared_count;
}
...
};
但boost / thread / detail / thread_interruption.hpp不包含disable_interruption的实现,只包含原型。
在boost_1_42_0 / libs / thread / src / pthread中我们也没有实现
它是如何工作的!???
答案 0 :(得分:1)
grep
在boost_1_42_0/libs/thread/src/pthread/thread.cpp
中找到它:
disable_interruption::disable_interruption():
interruption_was_enabled(interruption_enabled())
{
if(interruption_was_enabled)
{
detail::get_current_thread_data()->interrupt_enabled=false;
}
}
析构函数和方法也都存在。
答案 1 :(得分:0)
disable_interruption
有2个实现。
boost_1_42_0/libs/thread/src/pthread/thread.cpp
boost_1_42_0/libs/thread/src/win32/thread.cpp
根据您的平台链接相应的