Unblock any threads that are waiting on a mutex
#include <pthread.h> int pthread_mutex_wakeup_np( pthread_mutex_t * mutex, pid_t pid, pthread_t tid );
- A pointer to the pthread_mutex_t object for which you want to wake up any waiting threads.
- 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).
- The ID of a thread in the specified process that you want to unblock, or 0 to unblock all threads.
Use the -l c option to qcc to link against this library. This library is usually included automatically.
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 these functions' names 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.
- 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.
- The specified process and thread couldn't be found.