Attributes for pthread mutexes. More...
Attributes for pthread mutexes.
Definition in file pthread_mutex_attr.h.
#include <errno.h>
Include dependency graph for pthread_mutex_attr.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Data Structures | |
| struct | pthread_mutexattr_t |
| This type is unused right now, and only exists for POSIX compatibility. More... | |
| #define | PTHREAD_MUTEX_NORMAL 0 |
| A non-error correcting mutex (default). | |
| #define | PTHREAD_MUTEX_RECURSIVE 1 |
| A mutex that allows recursive locking. More... | |
| #define | PTHREAD_MUTEX_ERRORCHECK 2 |
A mutex that fails with EDEADLK if recursive locking was detected. More... | |
| #define | PTHREAD_MUTEX_DEFAULT PTHREAD_MUTEX_NORMAL |
| The default mutex kind for RIOT. More... | |
| #define | PTHREAD_PRIO_NONE 0 |
| No priority inheritance. More... | |
| #define | PTHREAD_PRIO_INHERIT 1 |
| If a thread attempts to acquire a held lock, the holding thread gets its dynamic priority increased up to the priority of the blocked thread. More... | |
| #define | PTHREAD_PRIO_PROTECT 2 |
| Not implemented, yet. | |
| #define | PTHREAD_MUTEX_STALLED 0 |
| Mutexes aren't automatically released on the end of a thread. More... | |
| #define | PTHREAD_MUTEX_ROBUST 1 |
| Mutexes that are held at the exit of a thread get released automatically. More... | |
| int | pthread_mutexattr_init (pthread_mutexattr_t *attr) |
| Initialize a pthread_mutexattr_t. More... | |
| int | pthread_mutexattr_destroy (pthread_mutexattr_t *attr) |
| Destroys a pthread_mutexattr_t. More... | |
| int | pthread_mutexattr_getpshared (const pthread_mutexattr_t *attr, int *pshared) |
| Queries the attribute set whether to share the mutex with child processes. More... | |
| int | pthread_mutexattr_setpshared (pthread_mutexattr_t *attr, int pshared) |
| Set whether to share the mutex with child processes. More... | |
| int | pthread_mutexattr_gettype (const pthread_mutexattr_t *attr, int *kind) |
| Query the type of the mutex to create. More... | |
| int | pthread_mutexattr_settype (pthread_mutexattr_t *attr, int kind) |
| Sets the type of the mutex to create. More... | |
| int | pthread_mutexattr_getprotocol (const pthread_mutexattr_t *attr, int *protocol) |
| Query the priority inheritance of the mutex to create. More... | |
| int | pthread_mutexattr_setprotocol (pthread_mutexattr_t *attr, int protocol) |
| Sets the priority inheritance of the mutex to create. More... | |
| int | pthread_mutexattr_getprioceiling (const pthread_mutexattr_t *attr, int *prioceiling) |
| int | pthread_mutexattr_setprioceiling (pthread_mutexattr_t *attr, int prioceiling) |
| int | pthread_mutexattr_getrobust (const pthread_mutexattr_t *attr, int *robustness) |
| Query the attribute set whether to create a robut mutex. More... | |
| int | pthread_mutexattr_setrobust (pthread_mutexattr_t *attr, int robustness) |
| Set whether the mutex to create should be robust. More... | |
| #define PTHREAD_MUTEX_DEFAULT PTHREAD_MUTEX_NORMAL |
The default mutex kind for RIOT.
Definition at line 47 of file pthread_mutex_attr.h.
| #define PTHREAD_MUTEX_ERRORCHECK 2 |
A mutex that fails with EDEADLK if recursive locking was detected.
Definition at line 46 of file pthread_mutex_attr.h.
| #define PTHREAD_MUTEX_RECURSIVE 1 |
A mutex that allows recursive locking.
Definition at line 45 of file pthread_mutex_attr.h.
| #define PTHREAD_MUTEX_ROBUST 1 |
Mutexes that are held at the exit of a thread get released automatically.
Definition at line 82 of file pthread_mutex_attr.h.
| #define PTHREAD_MUTEX_STALLED 0 |
Mutexes aren't automatically released on the end of a thread.
Definition at line 81 of file pthread_mutex_attr.h.
| #define PTHREAD_PRIO_INHERIT 1 |
If a thread attempts to acquire a held lock, the holding thread gets its dynamic priority increased up to the priority of the blocked thread.
Definition at line 63 of file pthread_mutex_attr.h.
| #define PTHREAD_PRIO_NONE 0 |
No priority inheritance.
Prone to inversed priorities. The default mutex protocol.
Definition at line 62 of file pthread_mutex_attr.h.
| int pthread_mutexattr_destroy | ( | pthread_mutexattr_t * | attr | ) |
Destroys a pthread_mutexattr_t.
There is no need to ever call this function. This function is a no-op.
| [in,out] | attr | Datum to destroy. |
0 on success. EINVAL if attr == NULL. | int pthread_mutexattr_getprotocol | ( | const pthread_mutexattr_t * | attr, |
| int * | protocol | ||
| ) |
Query the priority inheritance of the mutex to create.
PTHREAD_PRIO_NONE mutexes. | [in] | attr | Attribute set to query |
| [out] | protocol | Either PTHREAD_PRIO_NONE or PTHREAD_PRIO_INHERIT or PTHREAD_PRIO_PROTECT. |
0 on success. EINVAL if attr or protocol are NULL. | int pthread_mutexattr_getpshared | ( | const pthread_mutexattr_t * | attr, |
| int * | pshared | ||
| ) |
Queries the attribute set whether to share the mutex with child processes.
| [in] | attr | Attribute set to query. |
| [out] | pshared | Either PTHREAD_PROCESS_SHARED or PTHREAD_PROCESS_PRIVATE. |
0 on success. EINVAL if attr or pshared are NULL. | int pthread_mutexattr_getrobust | ( | const pthread_mutexattr_t * | attr, |
| int * | robustness | ||
| ) |
Query the attribute set whether to create a robut mutex.
A "robust" mutex releases gets released automagically if the threads exits while it hold the mutex. If the thread is cancellable, only rubust mutex should be held.
| [in] | attr | Attribute set to query. |
| [out] | robustness | Either PTHREAD_MUTEX_STALLED or PTHREAD_MUTEX_ROBUST. |
0 on success. EINVAL if the value of protocol is unsupported. EINVAL if attr or robustness is NULL. | int pthread_mutexattr_gettype | ( | const pthread_mutexattr_t * | attr, |
| int * | kind | ||
| ) |
Query the type of the mutex to create.
| [in] | attr | Attribute set to query. |
| [out] | kind | Either PTHREAD_MUTEX_NORMAL or PTHREAD_MUTEX_RECURSIVE or PTHREAD_MUTEX_ERRORCHECK. |
0 on success. EINVAL if attr or kind are NULL. | int pthread_mutexattr_init | ( | pthread_mutexattr_t * | attr | ) |
Initialize a pthread_mutexattr_t.
A zeroed out datum is initialized
| [out] | attr | Datum to initialize. |
0 on success. EINVAL if attr == NULL. | int pthread_mutexattr_setprotocol | ( | pthread_mutexattr_t * | attr, |
| int | protocol | ||
| ) |
Sets the priority inheritance of the mutex to create.
PTHREAD_PRIO_NONE mutexes. | [in,out] | attr | Attribute set to change. |
| [in] | protocol | Either PTHREAD_PRIO_NONE or PTHREAD_PRIO_INHERIT or PTHREAD_PRIO_PROTECT. |
0 on success. EINVAL if the value of protocol is unsupported. EINVAL if attr == NULL. | int pthread_mutexattr_setpshared | ( | pthread_mutexattr_t * | attr, |
| int | pshared | ||
| ) |
Set whether to share the mutex with child processes.
| [in,out] | attr | Attribute set to change. |
| [in] | pshared | Either PTHREAD_PROCESS_SHARED or PTHREAD_PROCESS_PRIVATE. |
0 on success. EINVAL if pshared is neither PTHREAD_PROCESS_SHARED nor PTHREAD_PROCESS_PRIVATE. EINVAL if attr == NULL. | int pthread_mutexattr_setrobust | ( | pthread_mutexattr_t * | attr, |
| int | robustness | ||
| ) |
Set whether the mutex to create should be robust.
A "robust" mutex releases gets released automagically if the threads exits while it hold the mutex. If the thread is cancellable, only rubust mutex should be held.
| [in,out] | attr | Attribute set to change. |
| [in] | robustness | Either PTHREAD_MUTEX_STALLED or PTHREAD_MUTEX_ROBUST. |
0 on success. EINVAL if the value of robustness is unsupported. EINVAL if attr == NULL. | int pthread_mutexattr_settype | ( | pthread_mutexattr_t * | attr, |
| int | kind | ||
| ) |
Sets the type of the mutex to create.
PTHREAD_MUTEX_NORMAL mutexes. | [in,out] | attr | Attribute set to change. |
| [in] | kind | Either PTHREAD_MUTEX_NORMAL or PTHREAD_MUTEX_RECURSIVE or PTHREAD_MUTEX_ERRORCHECK. |
0 on success. EINVAL if the value of kind is unsupported. EINVAL if attr == NULL.