forksafe_mutex_unlock()
Unlock a forksafe mutex
Synopsis:
#include <forksafe_mutex.h>
int forksafe_mutex_unlock( forksafe_mutex_t* mutex );
Arguments:
- mutex
- A pointer to the forksafe_mutex_t object that you want to unlock.
Library:
libc, libforksafe_mutex
There are two versions of the forksafe_mutex_*() functions:
- The functions in libc are declared as weak symbols and use a regular mutex, simply calling the corresponding pthread_mutex_*() functions. Use the -l c option to qcc to link against this library. This library is usually included automatically.
- The functions in libforksafe_mutex use a forksafe mutex. Use the -l forksafe_mutex option to qcc to link against this library.
Description:
The forksafe_mutex_unlock() function unlocks the forksafe mutex mutex. The mutex should be owned by the calling thread. If there are threads blocked on the mutex then the highest priority waiting thread is unblocked and becomes the next owner of the mutex.
If the thread's priority was raised when a higher-priority thread
attempted to lock the mutex, the calling thread's priority is again adjusted
when it unlocks the mutex;
its new priority is the maximum of its own priority and the priorities of
those threads it still blocks, either directly or indirectly.
For more information, see
Mutexes: mutual exclusion locks
in the IDE Microkernel chapter of the System Architecture guide.
If mutex has been locked more than once, it must be unlocked the same number of times before the next thread is given ownership of the mutex. This works only for recursive mutexes.
For more information about forksafe mutexes, see
Using fork() in a multithreaded process
in the Processes and Threads
chapter of Getting Started with the QNX OS.
Returns:
- EOK
- Success.
- EINVAL
- Invalid mutex mutex.
- EPERM
- The mutex type is PTHREAD_MUTEX_ERRORCHECK or PTHREAD_MUTEX_RECURSIVE, or the mutex is a robust mutex, and the current thread doesn't own the mutex.
Examples:
Classification:
Safety: | |
---|---|
Cancellation point | No |
Signal handler | No |
Thread | Yes |