Mutual exclusion. More...
Mutual exclusion.
Definition in file pthread_mutex.h.
Go to the source code of this file.
typedef mutex_t | pthread_mutex_t |
Pthread mutexes are quite the same as RIOT mutexes. More... | |
int | pthread_mutex_init (pthread_mutex_t *mutex, const pthread_mutexattr_t *mutexattr) |
Initialize a mutex. More... | |
int | pthread_mutex_destroy (pthread_mutex_t *mutex) |
Destroy a mutex. More... | |
int | pthread_mutex_trylock (pthread_mutex_t *mutex) |
Try to lock a mutex. More... | |
int | pthread_mutex_lock (pthread_mutex_t *mutex) |
Lock and hold a mutex. More... | |
int | pthread_mutex_timedlock (pthread_mutex_t *mutex, const struct timespec *abstime) |
Not implemented, yet. More... | |
int | pthread_mutex_unlock (pthread_mutex_t *mutex) |
Unlock a mutex. More... | |
int | pthread_mutex_getprioceiling (const pthread_mutex_t *mutex, int *prioceiling) |
Not implemented, yet. More... | |
int | pthread_mutex_setprioceiling (pthread_mutex_t *mutex, int prioceiling, int *old_ceiling) |
Not implemented, yet. More... | |
typedef mutex_t pthread_mutex_t |
Pthread mutexes are quite the same as RIOT mutexes.
Recursive locking is not supported. A thread can unlock a mutex even if it does not hold it.
Definition at line 33 of file pthread_mutex.h.
int pthread_mutex_destroy | ( | pthread_mutex_t * | mutex | ) |
Destroy a mutex.
This is currently a no-op. Destroying a mutex locked is undefined behavior.
[in,out] | mutex | Datum to destroy. |
int pthread_mutex_getprioceiling | ( | const pthread_mutex_t * | mutex, |
int * | prioceiling | ||
) |
Not implemented, yet.
Will cause a linktime error ...
[in] | mutex | The unused mutex. |
[out] | prioceiling | Unused. |
int pthread_mutex_init | ( | pthread_mutex_t * | mutex, |
const pthread_mutexattr_t * | mutexattr | ||
) |
Initialize a mutex.
A zeroed out datum is initialized.
[in,out] | mutex | Mutex to initialize. |
[in] | mutexattr | Unused. |
0
on success. -1
iff mutex == NULL
. int pthread_mutex_lock | ( | pthread_mutex_t * | mutex | ) |
Lock and hold a mutex.
This invocation may block if the mutex was locked.
[in] | mutex | Mutex to lock, must be initialized. |
-1
iff you managed to supply NULL
. 0
otherwise, you hold the mutex now. int pthread_mutex_setprioceiling | ( | pthread_mutex_t * | mutex, |
int | prioceiling, | ||
int * | old_ceiling | ||
) |
Not implemented, yet.
Will cause a linktime error ...
[in,out] | mutex | The unused mutex. |
[in] | prioceiling | Unused. |
[out] | old_ceiling | Unused. |
int pthread_mutex_timedlock | ( | pthread_mutex_t * | mutex, |
const struct timespec * | abstime | ||
) |
Not implemented, yet.
Will cause a linktime error ...
[in] | mutex | The unused mutex. |
[in] | abstime | The used absolute time. |
int pthread_mutex_trylock | ( | pthread_mutex_t * | mutex | ) |
Try to lock a mutex.
This function won't block.
[in] | mutex | Mutex to lock, must be initialized. |
0
if you hold the mutex now. +1
if the mutex already was locked. -1
if you managed to supply NULL
. int pthread_mutex_unlock | ( | pthread_mutex_t * | mutex | ) |
Unlock a mutex.
It is possible to unlock a mutex that you don't hold. It is possible to unlock a mutex that is not held at all. The mutex can still be locked afterwards if there were threads queuing for this mutex.
[in] | mutex | Mutex to unlock, must be initialized. |
-1
iff you managed to supply NULL
. 0
otherwise.