pthread_mutex.h¶
Mutual exclusion.
Note
Do not include this header file directly, but pthread.h.
-
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.
-
int
pthread_mutex_init(pthread_mutex.h::pthread_mutex_t* mutex, const pthread_mutexattr_t * mutexattr)¶ Initialize a mutex.
A zeroed out datum is initialized.
Parameters
mutex: Mutex to initialize. mutexattr: Unused. Return values
0on success.-1iffmutex == NULL.
-
int
pthread_mutex_destroy(pthread_mutex.h::pthread_mutex_t* mutex)¶ Destroy a mutex.
This is currently a no-op. Destroying a mutex locked is undefined behavior.
Parameters
mutex: Datum to destroy. Return values
- 0, this invocation is a no-op that cannot fail.
-
int
pthread_mutex_trylock(pthread_mutex.h::pthread_mutex_t* mutex)¶ Try to lock a mutex.
This function won’t block.
Parameters
mutex: Mutex to lock, must be initialized. Return values
0if you hold the mutex now.+1if the mutex already was locked.-1if you managed to supplyNULL.
-
int
pthread_mutex_lock(pthread_mutex.h::pthread_mutex_t* mutex)¶ Lock and hold a mutex.
This invocation may block if the mutex was locked.
Parameters
mutex: Mutex to lock, must be initialized. Return values
-1iff you managed to supplyNULL.0otherwise, you hold the mutex now.
-
int
pthread_mutex_timedlock(pthread_mutex.h::pthread_mutex_t* mutex, const struct timespec * abstime)¶ Not implemented, yet.
Will cause a linktime error …
Parameters
mutex: The unused mutex. abstime: The used absolute time. Return values
- Well … you’ll get a link time error, so nothing will be returned.
-
int
pthread_mutex_unlock(pthread_mutex.h::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.
Parameters
mutex: Mutex to unlock, must be initialized. Return values
-1iff you managed to supplyNULL.0otherwise.
-
int
pthread_mutex_getprioceiling(constpthread_mutex.h::pthread_mutex_t* mutex, int * prioceiling)¶ Not implemented, yet.
Will cause a linktime error …
Parameters
mutex: The unused mutex. prioceiling: Unused. Return values
- Well … you’ll get a link time error, so nothing will be returned.
-
int
pthread_mutex_setprioceiling(pthread_mutex.h::pthread_mutex_t* mutex, int prioceiling, int * old_ceiling)¶ Not implemented, yet.
Will cause a linktime error …
Parameters
mutex: The unused mutex. prioceiling: Unused. old_ceiling: Unused. Return values
- Well … you’ll get a link time error, so nothing will be returned.