Warning: This file is not a C or C++ file. It does not have highlighting.
1 | /* Mutex type. Generic version. |
---|---|
2 | |
3 | Copyright (C) 2000-2022 Free Software Foundation, Inc. |
4 | This file is part of the GNU C Library. |
5 | |
6 | The GNU C Library is free software; you can redistribute it and/or |
7 | modify it under the terms of the GNU Lesser General Public |
8 | License as published by the Free Software Foundation; either |
9 | version 2.1 of the License, or (at your option) any later version. |
10 | |
11 | The GNU C Library is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | Lesser General Public License for more details. |
15 | |
16 | You should have received a copy of the GNU Lesser General Public |
17 | License along with the GNU C Library; if not, see |
18 | <https://www.gnu.org/licenses/>. */ |
19 | |
20 | #ifndef _BITS_TYPES_STRUCT___PTHREAD_MUTEX_H |
21 | #define _BITS_TYPES_STRUCT___PTHREAD_MUTEX_H 1 |
22 | |
23 | #include <bits/types/__pthread_spinlock_t.h> |
24 | #include <bits/types/struct___pthread_mutexattr.h> |
25 | |
26 | /* User visible part of a mutex. */ |
27 | struct __pthread_mutex |
28 | { |
29 | __pthread_spinlock_t __held; |
30 | __pthread_spinlock_t __lock; |
31 | /* In cthreads, mutex_init does not initialized thre third |
32 | pointer, as such, we cannot rely on its value for anything. */ |
33 | char *__cthreadscompat1; |
34 | struct __pthread *__queue; |
35 | struct __pthread_mutexattr *__attr; |
36 | void *__data; |
37 | /* Up to this point, we are completely compatible with cthreads |
38 | and what libc expects. */ |
39 | void *__owner; |
40 | unsigned __locks; |
41 | /* If NULL then the default attributes apply. */ |
42 | }; |
43 | |
44 | /* Initializer for a mutex. N.B. this also happens to be compatible |
45 | with the cthread mutex initializer. */ |
46 | #define __PTHREAD_MUTEX_INITIALIZER \ |
47 | { __PTHREAD_SPIN_LOCK_INITIALIZER, __PTHREAD_SPIN_LOCK_INITIALIZER, 0, 0, 0, 0, 0, 0 } |
48 | |
49 | #define __PTHREAD_ERRORCHECK_MUTEXATTR ((struct __pthread_mutexattr *) ((unsigned long) __PTHREAD_MUTEX_ERRORCHECK + 1)) |
50 | |
51 | #define __PTHREAD_ERRORCHECK_MUTEX_INITIALIZER \ |
52 | { __PTHREAD_SPIN_LOCK_INITIALIZER, __PTHREAD_SPIN_LOCK_INITIALIZER, 0, 0, \ |
53 | __PTHREAD_ERRORCHECK_MUTEXATTR, 0, 0, 0 } |
54 | |
55 | #define __PTHREAD_RECURSIVE_MUTEXATTR ((struct __pthread_mutexattr *) ((unsigned long) __PTHREAD_MUTEX_RECURSIVE + 1)) |
56 | |
57 | #define __PTHREAD_RECURSIVE_MUTEX_INITIALIZER \ |
58 | { __PTHREAD_SPIN_LOCK_INITIALIZER, __PTHREAD_SPIN_LOCK_INITIALIZER, 0, 0, \ |
59 | __PTHREAD_RECURSIVE_MUTEXATTR, 0, 0, 0 } |
60 | |
61 | #endif /* bits/types/struct___pthread_mutex.h */ |
62 |
Warning: This file is not a C or C++ file. It does not have highlighting.