hurd: Bump remaining LGPL2+ htl licences to LGPL 2.1+
[glibc.git] / sysdeps / htl / bits / types / struct___pthread_mutex.h
blob564e6a3159d0fd198bea118783301f74b99ad23c
1 /* Mutex type. Generic version.
3 Copyright (C) 2000-2018 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.
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.
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.
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 <http://www.gnu.org/licenses/>. */
20 #ifndef _BITS_TYPES_STRUCT___PTHREAD_MUTEX_H
21 #define _BITS_TYPES_STRUCT___PTHREAD_MUTEX_H 1
23 #include <bits/types/__pthread_spinlock_t.h>
24 #include <bits/types/struct___pthread_mutexattr.h>
26 /* User visible part of a mutex. */
27 struct __pthread_mutex
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. */
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 }
49 #define __PTHREAD_ERRORCHECK_MUTEXATTR ((struct __pthread_mutexattr *) ((unsigned long) __PTHREAD_MUTEX_ERRORCHECK + 1))
51 #define __PTHREAD_ERRORCHECK_MUTEX_INITIALIZER \
52 { __PTHREAD_SPIN_LOCK_INITIALIZER, __PTHREAD_SPIN_LOCK_INITIALIZER, 0, 0, \
53 __PTHREAD_ERRORCHECK_MUTEXATTR, 0, 0, 0 }
55 #define __PTHREAD_RECURSIVE_MUTEXATTR ((struct __pthread_mutexattr *) ((unsigned long) __PTHREAD_MUTEX_RECURSIVE + 1))
57 #define __PTHREAD_RECURSIVE_MUTEX_INITIALIZER \
58 { __PTHREAD_SPIN_LOCK_INITIALIZER, __PTHREAD_SPIN_LOCK_INITIALIZER, 0, 0, \
59 __PTHREAD_RECURSIVE_MUTEXATTR, 0, 0, 0 }
61 #endif /* bits/types/struct___pthread_mutex.h */