|This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs.|
Unlock a mutex synchronization object
#include <sys/neutrino.h> int SyncMutexUnlock( sync_t * sync ); int SyncMutexUnlock_r( sync_t * sync );
- A pointer to the synchronization object for the mutex that you want to unlock.
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The SyncMutexUnlock() and SyncMutexUnlock_r() kernel calls unlock the mutex passed as sync. If there are threads blocked on the mutex, the owner member of sync is set to the thread ID of the thread with the highest priority that has been waiting the longest and it's made ready to run. If no threads are waiting, it's set to zero.
These functions are similar, except for the way they indicate errors. See the Returns section for details.
If the calling thread had its priority boosted while it owned the mutex, it returns to its normal priority.
|The POSIX functions pthread_mutex_lock(), and pthread_mutex_unlock(), are faster, since they can potentially avoid a kernel call.|
These calls don't block.
The only difference between these functions is the way they indicate errors:
- If an error occurs, The function returns -1 and sets errno. Any other value returned indicates success.
- Returns EOK on success. This function does NOT set errno. If an error occurs, the function returns any value listed in the Errors section.
- A fault occurred when the kernel tried to access the buffers provided.
- The synchronization ID specified in sync doesn't exist. The calling thread doesn't own the mutex.