pthread_mutex_attr.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014 Freie Universität Berlin
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
17 #ifndef PTHREAD_MUTEX_ATTR_H
18 #define PTHREAD_MUTEX_ATTR_H
19 
20 #include <errno.h>
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
45 #define PTHREAD_MUTEX_NORMAL 0
46 #define PTHREAD_MUTEX_RECURSIVE 1
47 #define PTHREAD_MUTEX_ERRORCHECK 2
48 #define PTHREAD_MUTEX_DEFAULT PTHREAD_MUTEX_NORMAL
49 
63 #define PTHREAD_PRIO_NONE 0
64 #define PTHREAD_PRIO_INHERIT 1
65 
81 #define PTHREAD_PRIO_PROTECT 2
82 #define PTHREAD_MUTEX_STALLED 0
83 #define PTHREAD_MUTEX_ROBUST 1
84 
88 typedef struct
89 {
90  int pshared;
91  int kind;
92  int protocol;
93  int robustness;
95 
105 
116 
125 int pthread_mutexattr_getpshared(const pthread_mutexattr_t *attr, int *pshared);
126 
136 int pthread_mutexattr_setpshared(pthread_mutexattr_t *attr, int pshared);
137 
146 int pthread_mutexattr_gettype(const pthread_mutexattr_t *attr, int *kind);
147 
158 
167 int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *attr, int *protocol);
168 
178 int pthread_mutexattr_setprotocol(pthread_mutexattr_t *attr, int protocol);
179 
180 /* Return in *PRIOCEILING the mutex prioceiling attribute in *ATTR. */
181 int pthread_mutexattr_getprioceiling(const pthread_mutexattr_t *attr, int *prioceiling);
182 
183 /* Set the mutex prioceiling attribute in *ATTR to PRIOCEILING. */
184 int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *attr, int prioceiling);
185 
198 int pthread_mutexattr_getrobust(const pthread_mutexattr_t *attr, int *robustness);
199 
212 int pthread_mutexattr_setrobust(pthread_mutexattr_t *attr, int robustness);
213 
214 #ifdef __cplusplus
215 }
216 #endif
217 
218 #endif /* PTHREAD_MUTEX_ATTR_H */
219 
pthread_mutexattr_t::pshared
int pshared
Whether to share the mutex with child processes.
Definition: pthread_mutex_attr.h:90
pthread_mutexattr_setpshared
int pthread_mutexattr_setpshared(pthread_mutexattr_t *attr, int pshared)
Set whether to share the mutex with child processes.
pthread_mutexattr_settype
int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int kind)
Sets the type of the mutex to create.
pthread_mutexattr_getprotocol
int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *attr, int *protocol)
Query the priority inheritance of the mutex to create.
pthread_mutexattr_t::kind
int kind
Type of the mutex.
Definition: pthread_mutex_attr.h:91
pthread_mutexattr_setrobust
int pthread_mutexattr_setrobust(pthread_mutexattr_t *attr, int robustness)
Set whether the mutex to create should be robust.
pthread_mutexattr_getrobust
int pthread_mutexattr_getrobust(const pthread_mutexattr_t *attr, int *robustness)
Query the attribute set whether to create a robut mutex.
pthread_mutexattr_t
This type is unused right now, and only exists for POSIX compatibility.
Definition: pthread_mutex_attr.h:88
pthread_mutexattr_getpshared
int pthread_mutexattr_getpshared(const pthread_mutexattr_t *attr, int *pshared)
Queries the attribute set whether to share the mutex with child processes.
pthread_mutexattr_init
int pthread_mutexattr_init(pthread_mutexattr_t *attr)
Initialize a pthread_mutexattr_t.
pthread_mutexattr_gettype
int pthread_mutexattr_gettype(const pthread_mutexattr_t *attr, int *kind)
Query the type of the mutex to create.
pthread_mutexattr_destroy
int pthread_mutexattr_destroy(pthread_mutexattr_t *attr)
Destroys a pthread_mutexattr_t.
pthread_mutexattr_t::robustness
int robustness
What to do if a thread terminates while it holds a mutex.
Definition: pthread_mutex_attr.h:93
pthread_mutexattr_setprotocol
int pthread_mutexattr_setprotocol(pthread_mutexattr_t *attr, int protocol)
Sets the priority inheritance of the mutex to create.
pthread_mutexattr_t::protocol
int protocol
Priority inheritance of the mutex.
Definition: pthread_mutex_attr.h:92
errno.h