pthreadCancelableTimedWait, pthreadCancelableWait – provide cancellation hooks for user Win32 routines
#include <pthread.h>
int pthreadCancelableTimedWait (HANDLE waitHandle, DWORD timeout);
int pthreadCancelableWait (HANDLE waitHandle);
These two functions provide hooks into the pthread_cancel() mechanism that will allow you to wait on a Windows handle and make it a cancellation point. Both functions block until either the given Win32 HANDLE is signalled, or pthread_cancel() has been called. They are implemented using WaitForMultipleObjects on waitHandle and the manually reset Win32 event handle that is the target of pthread_cancel(). These routines may be called from Win32 native threads but pthread_cancel() will require that thread's POSIX thread ID that the thread must retrieve using pthread_self().
pthreadCancelableTimedWait is the timed version that will return with the code ETIMEDOUT if the interval timeout milliseconds elapses before waitHandle is signalled.
These routines allow routines that block on Win32 HANDLEs to be cancellable via pthread_cancel().
The pthreadCancelableTimedWait function returns the following error code on error:
The interval timeout milliseconds elapsed before waitHandle was signalled.
Ross Johnson for use with Pthreads-w32.
pthread_cancel(), pthread_self()