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/ThreadInterruption.hpp不包含disable_interruption的实现,只包含原型。
在boost_1_42_0/libs/thread/src/pthread中,我们也没有实现
它是如何工作的!?
发布于 2010-05-06 20:04:00
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;
}
}析构函数和方法也都在那里。
发布于 2010-05-06 20:08:46
disable_interruption有两个实现。
boost_1_42_0/libs/thread/src/pthread/thread.cpp boost_1_42_0/libs/thread/src/win32/thread.cpp根据您的平台,您可以链接到适当的链接
https://stackoverflow.com/questions/2780631
复制相似问题