Mutexes with deadlock checking.
Mutexes | Mutexes with deadlock checking. |
Types | |
nacore_mutex | Mutex. |
Functions | |
nacore_mutex_new() | Creates a new mutex. |
nacore_mutex_free() | Destroys a mutex. |
nacore_mutex_lock() | Acquires the lock on a mutex. |
nacore_mutex_trylock() | Attempts to acquire the lock on a mutex. |
nacore_mutex_unlock() | Releases the lock on a mutex. |
_NACORE_DEF nacore_mutex nacore_mutex_new()
Creates a new mutex.
The newly creted mutex or NULL if some error occurred, in which case errno is set to EAGAIN if the system lacked the necessary resources (other than memory), ENOMEM if there was not enough memory, EPERM if the caller does not have the priviledge to perform the operation or NACORE_EUNKNOWN if another kind of error happened.
_NACORE_DEF int nacore_mutex_lock( nacore_mutex mutex )
Acquires the lock on a mutex.
If the mutex is locked by some other thread, the calling thread shall block until the mutex becomes available.
mutex | The mutex to acquire the lock on. |
0 on success or EDEADLK if the current thread already owns the mutex.
_NACORE_DEF int nacore_mutex_trylock( nacore_mutex mutex )
Attempts to acquire the lock on a mutex.
If the mutex is already locked by any thread, including the current thread, the call shall return immediately.
mutex | The mutex to acquire the lock on. |
0 on success or EBUSY if the lock couldn’t be acquired because it was already locked.
Creates a new mutex.
_NACORE_DEF nacore_mutex nacore_mutex_new()
Destroys a mutex.
_NACORE_DEF void nacore_mutex_free( nacore_mutex mutex )
Acquires the lock on a mutex.
_NACORE_DEF int nacore_mutex_lock( nacore_mutex mutex )
Attempts to acquire the lock on a mutex.
_NACORE_DEF int nacore_mutex_trylock( nacore_mutex mutex )
Releases the lock on a mutex.
_NACORE_DEF void nacore_mutex_unlock( nacore_mutex mutex )