pthread_mutex_wakeup_np()

Updated: April 19, 2023

Unblock any threads that are waiting on a mutex

Synopsis:

#include <pthread.h>

int pthread_mutex_wakeup_np( pthread_mutex_t * mutex,
                             pid_t pid,
                             pthread_t tid );

Arguments:

mutex
A pointer to the pthread_mutex_t object for which you want to wake up any waiting threads.
pid
The ID of a specific process whose thread or threads you want to unblock, or 0 to unblock a specific thread in the current process (if tid isn't 0) or all threads for all processes (if tid is 0).
tid
The ID of a thread in the specified process that you want to unblock, or 0 to unblock all threads.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The pthread_mutex_wakeup_np() function unblocks any threads that are waiting on the specified mutex, provided that PTHREAD_WAKEUP_ENABLE is set in the mutex attributes (see pthread_mutexattr_setwakeup_np()). The “np” in this function's name stands for “non-POSIX.”

The waiting threads' call to pthread_mutex_lock() for returns with an error code of EINTR, which is a non-POSIX return code for this function.

Returns:

EOK
Success.
EINVAL
One of the following:
  • The mutex doesn't exist.
  • The PTHREAD_WAKEUP_ENABLE flag wasn't set for the mutex.
  • You gave a specific thread ID, and that thread isn't blocked on the mutex.
ESRCH
The specified process and thread couldn't be found.

Classification:

QNX Neutrino

Safety:  
Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes