1 /* Copyright (C) 2002 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20 #ifndef _INTERNALTYPES_H
21 #define _INTERNALTYPES_H 1
26 /* Scheduler parameters and priority. */
27 struct sched_param schedparam;
29 /* Various flags like detachstate, scope, etc. */
31 /* Size of guard area. */
37 /* Chain of all initialized attributes. Keep this last since it is
39 struct pthread_attr *next;
42 #define ATTR_FLAG_DETACHSTATE 0x0001
43 #define ATTR_FLAG_NOTINHERITSCHED 0x0002
44 #define ATTR_FLAG_SCOPEPROCESS 0x0004
45 #define ATTR_FLAG_STACKADDR 0x0008
48 /* Mutex attribute data structure. */
49 struct pthread_mutexattr
51 /* Identifier for the kind of mutex.
53 Bit 31 is set if the mutex is to be shared between processes.
55 Bit 0 to 30 contain one of the PTHREAD_MUTEX_ values to identify
56 the type of the mutex. */
61 /* Conditional variable attribute data structure. */
62 struct pthread_condattr
64 /* Flag whether coditional variable will be shareable between processes. */
69 /* Read-write lock variable attribute data structure. */
70 struct pthread_rwlockattr
77 /* Barrier data structure. */
78 struct pthread_barrier
80 unsigned int curr_event;
83 unsigned int init_count;
87 /* Barrier variable attribute data structure. */
88 struct pthread_barrierattr
94 /* Thread-local data handling. */
95 struct pthread_key_struct
97 /* Sequence numbers. Even numbers indicated vacant entries. Note
98 that zero is even. We use uintptr_t to not require padding on
99 32- and 64-bit machines. On 64-bit machines it helps to avoid
103 /* Destructor for the data. */
104 void (*destr) (void *);
107 /* Check whether an entry is unused. */
108 #define KEY_UNUSED(p) (((p) & 1) == 0)
109 /* Check whether a key is usable. We cannot reuse an allocated key if
110 the sequence counter would overflow after the next destroy call.
111 This would mean that we potentially free memory for a key with the
112 same sequence. This is *very* unlikely to happen, A program would
113 have to create and destroy a key 2^31 times (on 32-bit platforms,
114 on 64-bit platforms that would be 2^63). If it should happen we
115 simply don't use this specific key anymore. */
116 #define KEY_USABLE(p) (((uintptr_t) (p)) < ((uintptr_t) ((p) + 2)))
119 /* Handling of read-write lock data. */
120 // XXX For now there is only one flag. Maybe more in future.
121 #define RWLOCK_RECURSIVE(rwlock) ((rwlock)->__data.__flags != 0)
124 /* Semaphore variable structure. */
130 #endif /* internaltypes.h */