1 /* Copyright (C) 2002, 2003 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
28 /* Scheduler parameters and priority. */
29 struct sched_param schedparam;
31 /* Various flags like detachstate, scope, etc. */
33 /* Size of guard area. */
39 /* Chain of all initialized attributes. Keep this last since it is
41 struct pthread_attr *next;
44 #define ATTR_FLAG_DETACHSTATE 0x0001
45 #define ATTR_FLAG_NOTINHERITSCHED 0x0002
46 #define ATTR_FLAG_SCOPEPROCESS 0x0004
47 #define ATTR_FLAG_STACKADDR 0x0008
50 /* Mutex attribute data structure. */
51 struct pthread_mutexattr
53 /* Identifier for the kind of mutex.
55 Bit 31 is set if the mutex is to be shared between processes.
57 Bit 0 to 30 contain one of the PTHREAD_MUTEX_ values to identify
58 the type of the mutex. */
63 /* Conditional variable attribute data structure. */
64 struct pthread_condattr
66 /* Flag whether coditional variable will be shareable between processes. */
71 /* Read-write lock variable attribute data structure. */
72 struct pthread_rwlockattr
79 /* Barrier data structure. */
80 struct pthread_barrier
82 unsigned int curr_event;
85 unsigned int init_count;
89 /* Barrier variable attribute data structure. */
90 struct pthread_barrierattr
96 /* Thread-local data handling. */
97 struct pthread_key_struct
99 /* Sequence numbers. Even numbers indicated vacant entries. Note
100 that zero is even. We use uintptr_t to not require padding on
101 32- and 64-bit machines. On 64-bit machines it helps to avoid
105 /* Destructor for the data. */
106 void (*destr) (void *);
109 /* Check whether an entry is unused. */
110 #define KEY_UNUSED(p) (((p) & 1) == 0)
111 /* Check whether a key is usable. We cannot reuse an allocated key if
112 the sequence counter would overflow after the next destroy call.
113 This would mean that we potentially free memory for a key with the
114 same sequence. This is *very* unlikely to happen, A program would
115 have to create and destroy a key 2^31 times (on 32-bit platforms,
116 on 64-bit platforms that would be 2^63). If it should happen we
117 simply don't use this specific key anymore. */
118 #define KEY_USABLE(p) (((uintptr_t) (p)) < ((uintptr_t) ((p) + 2)))
121 /* Handling of read-write lock data. */
122 // XXX For now there is only one flag. Maybe more in future.
123 #define RWLOCK_RECURSIVE(rwlock) ((rwlock)->__data.__flags != 0)
126 /* Semaphore variable structure. */
133 /* Compatibility type for old conditional variable interfaces. */
136 pthread_cond_t *cond;
137 } pthread_cond_2_0_t;
139 #endif /* internaltypes.h */