Loading...
Searching...
No Matches
pthread_mutex_attr.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2014 Freie Universität Berlin
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
15
16#include <errno.h>
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
41#define PTHREAD_MUTEX_NORMAL 0
42#define PTHREAD_MUTEX_RECURSIVE 1
43#define PTHREAD_MUTEX_ERRORCHECK 2
44#define PTHREAD_MUTEX_DEFAULT PTHREAD_MUTEX_NORMAL
45
59#define PTHREAD_PRIO_NONE 0
60#define PTHREAD_PRIO_INHERIT 1
61
77#define PTHREAD_PRIO_PROTECT 2
78#define PTHREAD_MUTEX_STALLED 0
79#define PTHREAD_MUTEX_ROBUST 1
80
84typedef struct
85{
86 int pshared;
87 int kind;
91
101
112
122
133
143
154
164
175
176/* Return in *PRIOCEILING the mutex prioceiling attribute in *ATTR. */
177int pthread_mutexattr_getprioceiling(const pthread_mutexattr_t *attr, int *prioceiling);
178
179/* Set the mutex prioceiling attribute in *ATTR to PRIOCEILING. */
180int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *attr, int prioceiling);
181
194int pthread_mutexattr_getrobust(const pthread_mutexattr_t *attr, int *robustness);
195
209
210#ifdef __cplusplus
211}
212#endif
213
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.