BOOST的Thread库博大精深,有很多的多线程概念在里面,今天就对其中很多call都用到的interrupt_wait的实现进行解释。首先,在BOOST文档中,有1个不得不看的概念,如下:
Predefined Interruption Points
The following functions are interruption points, which will throw boost::thread_interrupted
if interruption is enabled for the current thread, and interruption is requested for the current thread:
这个是说,有这么多的call可以用interrupt来打断,既有纯打断(属于无所事事,就想打断型)- interruption_point; 又有在休眠等待中被打断(从睡梦中惊醒)- 如其他。下面来看看官方的interrupt的描述