PTHREADCANCELLABLEWAIT(3) manual page

#### POSIX Threads for Windows – REFERENCE – Pthreads4W

Reference Index

Table of Contents

## Name

pthreadCancelableTimedWait, pthreadCancelableWait – provide cancellation hooks for user Win32 routines

## Synopsis

#include <pthread.h>

int pthreadCancelableTimedWait (HANDLE waitHandle, DWORD timeout);

int pthreadCancelableWait (HANDLE waitHandle);

## Description

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.

## Cancellation

These routines allow routines that block on Win32 HANDLEs to be cancellable via pthread_cancel().

## Return Value

## Errors

The pthreadCancelableTimedWait function returns the following error code on error:

ETIMEDOUT

The interval timeout milliseconds elapsed before waitHandle was signalled.

## Author

Ross Johnson for use with Pthreads4W.

## See also

pthread_cancel(), pthread_self()

Table of Contents

- Name

- Synopsis

- Description

- Cancellation

- Return Value

- Errors

- Author

- See also