1 /* Copyright (C) 2002, 2003, 2004, 2007, 2008 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
4 OpenSolaris bits contributed by David Bartley
5 <dtbartle@csclub.uwaterloo.ca>, 2008.
7 The GNU C Library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or (at your option) any later version.
12 The GNU C Library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
17 You should have received a copy of the GNU Lesser General Public
18 License along with the GNU C Library; if not, write to the Free
19 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
22 #ifndef _INTERNALTYPES_H
23 #define _INTERNALTYPES_H 1
32 /* Scheduler parameters and priority. */
33 struct sched_param schedparam;
35 /* Various flags like detachstate, scope, etc. */
37 /* Size of guard area. */
47 #define ATTR_FLAG_DETACHSTATE 0x0001
48 #define ATTR_FLAG_NOTINHERITSCHED 0x0002
49 #define ATTR_FLAG_SCOPEPROCESS 0x0004
50 #define ATTR_FLAG_STACKADDR 0x0008
51 #define ATTR_FLAG_OLDATTR 0x0010
52 #define ATTR_FLAG_SCHED_SET 0x0020
53 #define ATTR_FLAG_POLICY_SET 0x0040
54 #define ATTR_FLAG_DAEMON 0x0080
55 #define ATTR_FLAG_SUSPENDED 0x0100
56 #define ATTR_FLAG_THR_CREATE 0x0200
59 /* Mutex attribute data structure. */
60 struct pthread_mutexattr
62 /* Identifier for the kind of mutex.
64 Bit 31 is set if the mutex is to be shared between processes.
66 Bit 0 to 30 contain one of the PTHREAD_MUTEX_ values to identify
67 the type of the mutex. */
72 /* Conditional variable attribute data structure. */
73 struct pthread_condattr
75 /* Combination of values:
77 Bit 0 : flag whether coditional variable will be shareable between
85 /* The __NWAITERS field is used as a counter and to house the number
86 of bits for other purposes. COND_CLOCK_BITS is the number
87 of bits needed to represent the ID of the clock. COND_NWAITERS_SHIFT
88 is the number of bits reserved for other purposes like the clock. */
89 #define COND_CLOCK_BITS 1
90 #define COND_NWAITERS_SHIFT 1
93 /* Read-write lock variable attribute data structure. */
94 struct pthread_rwlockattr
100 #define BARRIER_EXITING 0x01
102 /* Barrier data structure. */
103 struct pthread_barrier
105 pthread_mutex_t mutex;
107 unsigned int curr_event;
109 unsigned int init_count;
114 /* Barrier variable attribute data structure. */
115 struct pthread_barrierattr
121 /* Thread-local data handling. */
122 struct pthread_key_struct
124 /* Sequence numbers. Even numbers indicated vacant entries. Note
125 that zero is even. We use uintptr_t to not require padding on
126 32- and 64-bit machines. On 64-bit machines it helps to avoid
130 /* Destructor for the data. */
131 void (*destr) (void *);
134 /* Check whether an entry is unused. */
135 #define KEY_UNUSED(p) (((p) & 1) == 0)
136 /* Check whether a key is usable. We cannot reuse an allocated key if
137 the sequence counter would overflow after the next destroy call.
138 This would mean that we potentially free memory for a key with the
139 same sequence. This is *very* unlikely to happen, A program would
140 have to create and destroy a key 2^31 times (on 32-bit platforms,
141 on 64-bit platforms that would be 2^63). If it should happen we
142 simply don't use this specific key anymore. */
143 #define KEY_USABLE(p) (((uintptr_t) (p)) < ((uintptr_t) ((p) + 2)))
146 /* Handling of read-write lock data. */
147 // XXX For now there is only one flag. Maybe more in future.
148 //#define RWLOCK_RECURSIVE(rwlock) ((rwlock)->__data.__flags != 0)
151 /* Compatibility type for old conditional variable interfaces. */
154 pthread_cond_t *cond;
155 } pthread_cond_2_0_t;
157 #endif /* internaltypes.h */