The friendly Operating System for the Internet of Things
pthread_mutex_attr.h File Reference

Attributes for pthread mutexes. More...

Detailed Description

Note
Do not include this header file directly, but pthread.h.

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...
 

Macro Definition Documentation

#define PTHREAD_MUTEX_DEFAULT   PTHREAD_MUTEX_NORMAL
Note
Not implemented, yet.

Definition at line 48 of file pthread_mutex_attr.h.

#define PTHREAD_MUTEX_ERRORCHECK   2
Note
Not implemented, yet.

Definition at line 47 of file pthread_mutex_attr.h.

#define PTHREAD_MUTEX_RECURSIVE   1
Note
Not implemented, yet.

Definition at line 46 of file pthread_mutex_attr.h.

#define PTHREAD_MUTEX_ROBUST   1
Note
Not implemented, yet.

Definition at line 83 of file pthread_mutex_attr.h.

#define PTHREAD_MUTEX_STALLED   0
See also
pthread_cleanup_push() for an option to unlock mutexes on the end of a thread.
Note
This is the default.

Definition at line 82 of file pthread_mutex_attr.h.

#define PTHREAD_PRIO_INHERIT   1
Note
Not implemented, yet.

Definition at line 64 of file pthread_mutex_attr.h.

#define PTHREAD_PRIO_NONE   0

Prone to inversed priorities. The default mutex protocol.

Definition at line 63 of file pthread_mutex_attr.h.

Function Documentation

int pthread_mutexattr_destroy ( pthread_mutexattr_t attr)

There is no need to ever call this function. This function is a no-op.

Note
This function is not implemented, yet.
Parameters
[in,out]attrDatum to destroy.
Returns
0 on success. EINVAL if attr == NULL.
int pthread_mutexattr_getprotocol ( const pthread_mutexattr_t attr,
int *  protocol 
)
Note
This implementation only supports PTHREAD_PRIO_NONE mutexes.
Parameters
[in]attrAttribute set to query
[out]protocolEither PTHREAD_PRIO_NONE or PTHREAD_PRIO_INHERIT or PTHREAD_PRIO_PROTECT.
Returns
0 on success. EINVAL if attr or protocol are NULL.
int pthread_mutexattr_getpshared ( const pthread_mutexattr_t attr,
int *  pshared 
)
Note
Since RIOT does not implement processes, this value is unused.
Parameters
[in]attrAttribute set to query.
[out]psharedEither PTHREAD_PROCESS_SHARED or PTHREAD_PROCESS_PRIVATE.
Returns
0 on success. EINVAL if attr or pshared are NULL.
int pthread_mutexattr_getrobust ( const pthread_mutexattr_t attr,
int *  robustness 
)

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.

Note
This implementation does not support robust mutexes, yet. As it doesn't implement cancellation points, yet, this should not pose a problem.
Parameters
[in]attrAttribute set to query.
[out]robustnessEither PTHREAD_MUTEX_STALLED or PTHREAD_MUTEX_ROBUST.
Returns
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 
)
Note
This implementation only supports PTHREAD_MUTEX_NORMAL mutexes.
Parameters
[in]attrAttribute set to query.
[out]kindEither PTHREAD_MUTEX_NORMAL or PTHREAD_MUTEX_RECURSIVE or PTHREAD_MUTEX_ERRORCHECK.
Returns
0 on success. EINVAL if attr or kind are NULL.
int pthread_mutexattr_init ( pthread_mutexattr_t attr)

A zeroed out datum is initialized

Note
This function is not implemented, yet.
Parameters
[out]attrDatum to initialize.
Returns
0 on success. EINVAL if attr == NULL.
int pthread_mutexattr_setprotocol ( pthread_mutexattr_t attr,
int  protocol 
)
Note
This implementation only supports PTHREAD_PRIO_NONE mutexes.
Parameters
[in,out]attrAttribute set to change.
[in]protocolEither PTHREAD_PRIO_NONE or PTHREAD_PRIO_INHERIT or PTHREAD_PRIO_PROTECT.
Returns
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 
)
Note
Since RIOT does not implement processes, this value is unused.
Parameters
[in,out]attrAttribute set to change.
[in]psharedEither PTHREAD_PROCESS_SHARED or PTHREAD_PROCESS_PRIVATE.
Returns
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 
)

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.

Note
This implementation does not support robust mutexes, yet. As it doesn't implement cancellation points, yet, this should not pose a problem.
Parameters
[in,out]attrAttribute set to change.
[in]robustnessEither PTHREAD_MUTEX_STALLED or PTHREAD_MUTEX_ROBUST.
Returns
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 
)
Note
This implementation only supports PTHREAD_MUTEX_NORMAL mutexes.
Parameters
[in,out]attrAttribute set to change.
[in]kindEither PTHREAD_MUTEX_NORMAL or PTHREAD_MUTEX_RECURSIVE or PTHREAD_MUTEX_ERRORCHECK.
Returns
0 on success. EINVAL if the value of kind is unsupported. EINVAL if attr == NULL.