Boost thread's have the convenient feature of being "interruptible". The framework introduces interruption points when you sleep, etc. However, using blocking Win32 calls circumvent this feature. For example, WaitForSingleObject
will block a thread but won't let it be interrupted by boost thread's interruption mechanism.
Is there some way to wrap WaitForSingleObject
or tell boost to wait on a Win32 event handle so that I can regain the interruption point?
detail::win32::interruptible_wait
implements just this.As you can see it awaits 3 handles (2 in addition to the one specified by the caller) to honour interruption.
See specifically
WaitForMultipleObjectsEx
callthe block
For reference, Boost License: