Loading...
Searching...
No Matches
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
23extern "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
88typedef struct
89{
90 int pshared;
91 int kind;
95
105
116
126
137
147
158
168
179
180/* Return in *PRIOCEILING the mutex prioceiling attribute in *ATTR. */
181int pthread_mutexattr_getprioceiling(const pthread_mutexattr_t *attr, int *prioceiling);
182
183/* Set the mutex prioceiling attribute in *ATTR to PRIOCEILING. */
184int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *attr, int prioceiling);
185
198int pthread_mutexattr_getrobust(const pthread_mutexattr_t *attr, int *robustness);
199
213
214#ifdef __cplusplus
215}
216#endif
217
218#endif /* PTHREAD_MUTEX_ATTR_H */
219
int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *attr, int *protocol)
Query the priority inheritance of the mutex to create.
int pthread_mutexattr_destroy(pthread_mutexattr_t *attr)
Destroys a pthread_mutexattr_t.
int pthread_mutexattr_getrobust(const pthread_mutexattr_t *attr, int *robustness)
Query the attribute set whether to create a robut mutex.
int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int kind)
Sets the type of the mutex to create.
int pthread_mutexattr_setpshared(pthread_mutexattr_t *attr, int pshared)
Set whether to share the mutex with child processes.
int pthread_mutexattr_setrobust(pthread_mutexattr_t *attr, int robustness)
Set whether the mutex to create should be robust.
int pthread_mutexattr_gettype(const pthread_mutexattr_t *attr, int *kind)
Query the type of the mutex to create.
int pthread_mutexattr_setprotocol(pthread_mutexattr_t *attr, int protocol)
Sets the priority inheritance of the mutex to create.
int pthread_mutexattr_getpshared(const pthread_mutexattr_t *attr, int *pshared)
Queries the attribute set whether to share the mutex with child processes.
int pthread_mutexattr_init(pthread_mutexattr_t *attr)
Initialize a pthread_mutexattr_t.
This type is unused right now, and only exists for POSIX compatibility.
int kind
Type of the mutex.
int protocol
Priority inheritance of the mutex.
int pshared
Whether to share the mutex with child processes.
int robustness
What to do if a thread terminates while it holds a mutex.