Unlock a mutex synchronization object
#include <sys/neutrino.h> int SyncMutexUnlock( sync_t * sync ); int SyncMutexUnlock_r( sync_t * sync );
libc
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:
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |
pthread_mutex_lock(), pthread_mutex_unlock(), SyncTypeCreate(), SyncMutexLock()