OpenCores
URL https://opencores.org/ocsvn/altor32/altor32/trunk

Subversion Repositories altor32

[/] [altor32/] [trunk/] [gcc-x64/] [or1knd-elf/] [or1knd-elf/] [include/] [pthread.h] - Blame information for rev 35

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 35 ultra_embe
/*  pthread.h
2
 *
3
 *  Written by Joel Sherrill <joel@OARcorp.com>.
4
 *
5
 *  COPYRIGHT (c) 1989-2010.
6
 *  On-Line Applications Research Corporation (OAR).
7
 *
8
 *  Permission to use, copy, modify, and distribute this software for any
9
 *  purpose without fee is hereby granted, provided that this entire notice
10
 *  is included in all copies of any software which is or includes a copy
11
 *  or modification of this software.
12
 *
13
 *  THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
14
 *  WARRANTY.  IN PARTICULAR,  THE AUTHOR MAKES NO REPRESENTATION
15
 *  OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY OF THIS
16
 *  SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
17
 *
18
 *  $Id: pthread.h,v 1.9 2010/12/08 14:44:06 corinna Exp $
19
 */
20
 
21
#ifndef __PTHREAD_h
22
#define __PTHREAD_h
23
 
24
#ifdef __cplusplus
25
extern "C" {
26
#endif
27
 
28
#include <unistd.h>
29
 
30
#if defined(_POSIX_THREADS)
31
 
32
#include <sys/types.h>
33
#include <time.h>
34
#include <sys/sched.h>
35
 
36
/* Register Fork Handlers */
37
int     _EXFUN(pthread_atfork,(void (*prepare)(void), void (*parent)(void),
38
                   void (*child)(void)));
39
 
40
/* Mutex Initialization Attributes, P1003.1c/Draft 10, p. 81 */
41
 
42
int     _EXFUN(pthread_mutexattr_init, (pthread_mutexattr_t *__attr));
43
int     _EXFUN(pthread_mutexattr_destroy, (pthread_mutexattr_t *__attr));
44
int     _EXFUN(pthread_mutexattr_getpshared,
45
                (_CONST pthread_mutexattr_t *__attr, int  *__pshared));
46
int     _EXFUN(pthread_mutexattr_setpshared,
47
                (pthread_mutexattr_t *__attr, int __pshared));
48
 
49
#if defined(_UNIX98_THREAD_MUTEX_ATTRIBUTES)
50
 
51
/* Single UNIX Specification 2 Mutex Attributes types */
52
 
53
int _EXFUN(pthread_mutexattr_gettype,
54
                (_CONST pthread_mutexattr_t *__attr, int *__kind));
55
int _EXFUN(pthread_mutexattr_settype,
56
                (pthread_mutexattr_t *__attr, int __kind));
57
 
58
#endif
59
 
60
/* Initializing and Destroying a Mutex, P1003.1c/Draft 10, p. 87 */
61
 
62
int     _EXFUN(pthread_mutex_init,
63
        (pthread_mutex_t *__mutex, _CONST pthread_mutexattr_t *__attr));
64
int     _EXFUN(pthread_mutex_destroy, (pthread_mutex_t *__mutex));
65
 
66
/* This is used to statically initialize a pthread_mutex_t. Example:
67
 
68
    pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
69
 */
70
 
71
#define PTHREAD_MUTEX_INITIALIZER  ((pthread_mutex_t) 0xFFFFFFFF)
72
 
73
/*  Locking and Unlocking a Mutex, P1003.1c/Draft 10, p. 93
74
    NOTE: P1003.4b/D8 adds pthread_mutex_timedlock(), p. 29 */
75
 
76
int     _EXFUN(pthread_mutex_lock, (pthread_mutex_t *__mutex));
77
int     _EXFUN(pthread_mutex_trylock, (pthread_mutex_t *__mutex));
78
int     _EXFUN(pthread_mutex_unlock, (pthread_mutex_t *__mutex));
79
 
80
#if defined(_POSIX_TIMEOUTS)
81
 
82
int     _EXFUN(pthread_mutex_timedlock,
83
        (pthread_mutex_t *__mutex, _CONST struct timespec *__timeout));
84
 
85
#endif /* _POSIX_TIMEOUTS */
86
 
87
/* Condition Variable Initialization Attributes, P1003.1c/Draft 10, p. 96 */
88
 
89
int     _EXFUN(pthread_condattr_init, (pthread_condattr_t *__attr));
90
int     _EXFUN(pthread_condattr_destroy, (pthread_condattr_t *__attr));
91
int     _EXFUN(pthread_condattr_getpshared,
92
                (_CONST pthread_condattr_t *__attr, int *__pshared));
93
int     _EXFUN(pthread_condattr_setpshared,
94
                (pthread_condattr_t *__attr, int __pshared));
95
 
96
/* Initializing and Destroying a Condition Variable, P1003.1c/Draft 10, p. 87 */
97
 
98
int     _EXFUN(pthread_cond_init,
99
        (pthread_cond_t *__cond, _CONST pthread_condattr_t *__attr));
100
int     _EXFUN(pthread_cond_destroy, (pthread_cond_t *__mutex));
101
 
102
/* This is used to statically initialize a pthread_cond_t. Example:
103
 
104
    pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
105
 */
106
 
107
#define PTHREAD_COND_INITIALIZER  ((pthread_mutex_t) 0xFFFFFFFF)
108
 
109
/* Broadcasting and Signaling a Condition, P1003.1c/Draft 10, p. 101 */
110
 
111
int     _EXFUN(pthread_cond_signal, (pthread_cond_t *__cond));
112
int     _EXFUN(pthread_cond_broadcast, (pthread_cond_t *__cond));
113
 
114
/* Waiting on a Condition, P1003.1c/Draft 10, p. 105 */
115
 
116
int     _EXFUN(pthread_cond_wait,
117
        (pthread_cond_t *__cond, pthread_mutex_t *__mutex));
118
 
119
int     _EXFUN(pthread_cond_timedwait,
120
                (pthread_cond_t *__cond, pthread_mutex_t *__mutex,
121
                _CONST struct timespec *__abstime));
122
 
123
#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING)
124
 
125
/* Thread Creation Scheduling Attributes, P1003.1c/Draft 10, p. 120 */
126
 
127
int     _EXFUN(pthread_attr_setscope,
128
                (pthread_attr_t *__attr, int __contentionscope));
129
int     _EXFUN(pthread_attr_getscope,
130
        (_CONST pthread_attr_t *__attr, int *__contentionscope));
131
int     _EXFUN(pthread_attr_setinheritsched,
132
        (pthread_attr_t *__attr, int __inheritsched));
133
int     _EXFUN(pthread_attr_getinheritsched,
134
        (_CONST pthread_attr_t *__attr, int *__inheritsched));
135
int     _EXFUN(pthread_attr_setschedpolicy,
136
        (pthread_attr_t *__attr, int __policy));
137
int     _EXFUN(pthread_attr_getschedpolicy,
138
        (_CONST pthread_attr_t *__attr, int *__policy));
139
 
140
#endif /* defined(_POSIX_THREAD_PRIORITY_SCHEDULING) */
141
 
142
int     _EXFUN(pthread_attr_setschedparam,
143
        (pthread_attr_t *__attr, _CONST struct sched_param *__param));
144
int     _EXFUN(pthread_attr_getschedparam,
145
        (_CONST pthread_attr_t *__attr, struct sched_param *__param));
146
 
147
#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING)
148
 
149
/* Dynamic Thread Scheduling Parameters Access, P1003.1c/Draft 10, p. 124 */
150
 
151
int     _EXFUN(pthread_getschedparam,
152
        (pthread_t __pthread, int *__policy, struct sched_param *__param));
153
int     _EXFUN(pthread_setschedparam,
154
        (pthread_t __pthread, int __policy, struct sched_param *__param));
155
 
156
#endif /* defined(_POSIX_THREAD_PRIORITY_SCHEDULING) */
157
 
158
#if defined(_POSIX_THREAD_PRIO_INHERIT) || defined(_POSIX_THREAD_PRIO_PROTECT)
159
 
160
/* Mutex Initialization Scheduling Attributes, P1003.1c/Draft 10, p. 128 */
161
 
162
int     _EXFUN(pthread_mutexattr_setprotocol,
163
        (pthread_mutexattr_t *__attr, int __protocol));
164
int     _EXFUN(pthread_mutexattr_getprotocol,
165
        (_CONST pthread_mutexattr_t *__attr, int *__protocol));
166
int     _EXFUN(pthread_mutexattr_setprioceiling,
167
        (pthread_mutexattr_t *__attr, int __prioceiling));
168
int     _EXFUN(pthread_mutexattr_getprioceiling,
169
        (_CONST pthread_mutexattr_t *__attr, int *__prioceiling));
170
 
171
#endif /* _POSIX_THREAD_PRIO_INHERIT || _POSIX_THREAD_PRIO_PROTECT */
172
 
173
#if defined(_POSIX_THREAD_PRIO_PROTECT)
174
 
175
/* Change the Priority Ceiling of a Mutex, P1003.1c/Draft 10, p. 131 */
176
 
177
int     _EXFUN(pthread_mutex_setprioceiling,
178
        (pthread_mutex_t *__mutex, int __prioceiling, int *__old_ceiling));
179
int     _EXFUN(pthread_mutex_getprioceiling,
180
        (pthread_mutex_t *__mutex, int *__prioceiling));
181
 
182
#endif /* _POSIX_THREAD_PRIO_PROTECT */
183
 
184
/* Thread Creation Attributes, P1003.1c/Draft 10, p, 140 */
185
 
186
int     _EXFUN(pthread_attr_init, (pthread_attr_t *__attr));
187
int     _EXFUN(pthread_attr_destroy, (pthread_attr_t *__attr));
188
int     _EXFUN(pthread_attr_setstack, (pthread_attr_t *attr,
189
        void *__stackaddr, size_t __stacksize));
190
int     _EXFUN(pthread_attr_getstack, (_CONST pthread_attr_t *attr,
191
        void **__stackaddr, size_t *__stacksize));
192
int     _EXFUN(pthread_attr_getstacksize,
193
        (_CONST pthread_attr_t *__attr, size_t *__stacksize));
194
int     _EXFUN(pthread_attr_setstacksize,
195
        (pthread_attr_t *__attr, size_t __stacksize));
196
int     _EXFUN(pthread_attr_getstackaddr,
197
        (_CONST pthread_attr_t *__attr, void **__stackaddr));
198
int     _EXFUN(pthread_attr_setstackaddr,
199
        (pthread_attr_t  *__attr, void *__stackaddr));
200
int     _EXFUN(pthread_attr_getdetachstate,
201
        (_CONST pthread_attr_t *__attr, int *__detachstate));
202
int     _EXFUN(pthread_attr_setdetachstate,
203
        (pthread_attr_t *__attr, int __detachstate));
204
int     _EXFUN(pthread_attr_getguardsize,
205
        (_CONST pthread_attr_t *__attr, size_t *__guardsize));
206
int     _EXFUN(pthread_attr_setguardsize,
207
        (pthread_attr_t *__attr, size_t __guardsize));
208
 
209
/* Thread Creation, P1003.1c/Draft 10, p. 144 */
210
 
211
int     _EXFUN(pthread_create,
212
        (pthread_t *__pthread, _CONST pthread_attr_t  *__attr,
213
        void *(*__start_routine)( void * ), void *__arg));
214
 
215
/* Wait for Thread Termination, P1003.1c/Draft 10, p. 147 */
216
 
217
int     _EXFUN(pthread_join, (pthread_t __pthread, void **__value_ptr));
218
 
219
/* Detaching a Thread, P1003.1c/Draft 10, p. 149 */
220
 
221
int     _EXFUN(pthread_detach, (pthread_t __pthread));
222
 
223
/* Thread Termination, p1003.1c/Draft 10, p. 150 */
224
 
225
void    _EXFUN(pthread_exit, (void *__value_ptr));
226
 
227
/* Get Calling Thread's ID, p1003.1c/Draft 10, p. XXX */
228
 
229
pthread_t       _EXFUN(pthread_self, (void));
230
 
231
/* Compare Thread IDs, p1003.1c/Draft 10, p. 153 */
232
 
233
int     _EXFUN(pthread_equal, (pthread_t __t1, pthread_t __t2));
234
 
235
/* Dynamic Package Initialization */
236
 
237
/* This is used to statically initialize a pthread_once_t. Example:
238
 
239
    pthread_once_t once = PTHREAD_ONCE_INIT;
240
 
241
    NOTE:  This is named inconsistently -- it should be INITIALIZER.  */
242
 
243
#define PTHREAD_ONCE_INIT  { 1, 0 }  /* is initialized and not run */
244
 
245
int     _EXFUN(pthread_once,
246
        (pthread_once_t *__once_control, void (*__init_routine)(void)));
247
 
248
/* Thread-Specific Data Key Create, P1003.1c/Draft 10, p. 163 */
249
 
250
int     _EXFUN(pthread_key_create,
251
        (pthread_key_t *__key, void (*__destructor)( void * )));
252
 
253
/* Thread-Specific Data Management, P1003.1c/Draft 10, p. 165 */
254
 
255
int     _EXFUN(pthread_setspecific,
256
        (pthread_key_t __key, _CONST void *__value));
257
void *  _EXFUN(pthread_getspecific, (pthread_key_t __key));
258
 
259
/* Thread-Specific Data Key Deletion, P1003.1c/Draft 10, p. 167 */
260
 
261
int     _EXFUN(pthread_key_delete, (pthread_key_t __key));
262
 
263
/* Execution of a Thread, P1003.1c/Draft 10, p. 181 */
264
 
265
#define PTHREAD_CANCEL_ENABLE  0
266
#define PTHREAD_CANCEL_DISABLE 1
267
 
268
#define PTHREAD_CANCEL_DEFERRED 0
269
#define PTHREAD_CANCEL_ASYNCHRONOUS 1
270
 
271
#define PTHREAD_CANCELED ((void *) -1)
272
 
273
int     _EXFUN(pthread_cancel, (pthread_t __pthread));
274
 
275
/* Setting Cancelability State, P1003.1c/Draft 10, p. 183 */
276
 
277
int     _EXFUN(pthread_setcancelstate, (int __state, int *__oldstate));
278
int     _EXFUN(pthread_setcanceltype, (int __type, int *__oldtype));
279
void    _EXFUN(pthread_testcancel, (void));
280
 
281
/* Establishing Cancellation Handlers, P1003.1c/Draft 10, p. 184 */
282
 
283
void    _EXFUN(pthread_cleanup_push,
284
        (void (*__routine)( void * ), void *__arg));
285
void    _EXFUN(pthread_cleanup_pop, (int __execute));
286
 
287
#if defined(_POSIX_THREAD_CPUTIME)
288
 
289
/* Accessing a Thread CPU-time Clock, P1003.4b/D8, p. 58 */
290
 
291
int     _EXFUN(pthread_getcpuclockid,
292
        (pthread_t __pthread_id, clockid_t *__clock_id));
293
 
294
#endif /* defined(_POSIX_THREAD_CPUTIME) */
295
 
296
 
297
#endif /* defined(_POSIX_THREADS) */
298
 
299
#if defined(_POSIX_BARRIERS)
300
 
301
int     _EXFUN(pthread_barrierattr_init, (pthread_barrierattr_t *__attr));
302
int     _EXFUN(pthread_barrierattr_destroy, (pthread_barrierattr_t *__attr));
303
int     _EXFUN(pthread_barrierattr_getpshared,
304
        (_CONST pthread_barrierattr_t *__attr, int *__pshared));
305
int     _EXFUN(pthread_barrierattr_setpshared,
306
        (pthread_barrierattr_t *__attr, int __pshared));
307
 
308
#define PTHREAD_BARRIER_SERIAL_THREAD -1
309
 
310
int     _EXFUN(pthread_barrier_init,
311
        (pthread_barrier_t *__barrier,
312
        _CONST pthread_barrierattr_t *__attr, unsigned __count));
313
int     _EXFUN(pthread_barrier_destroy, (pthread_barrier_t *__barrier));
314
int     _EXFUN(pthread_barrier_wait,(pthread_barrier_t *__barrier));
315
 
316
#endif /* defined(_POSIX_BARRIERS) */
317
 
318
#if defined(_POSIX_SPIN_LOCKS)
319
 
320
int     _EXFUN(pthread_spin_init,
321
        (pthread_spinlock_t *__spinlock, int __pshared));
322
int     _EXFUN(pthread_spin_destroy, (pthread_spinlock_t *__spinlock));
323
int     _EXFUN(pthread_spin_lock, (pthread_spinlock_t *__spinlock));
324
int     _EXFUN(pthread_spin_trylock, (pthread_spinlock_t *__spinlock));
325
int     _EXFUN(pthread_spin_unlock, (pthread_spinlock_t *__spinlock));
326
 
327
#endif /* defined(_POSIX_SPIN_LOCKS) */
328
 
329
#if defined(_POSIX_READER_WRITER_LOCKS)
330
 
331
int     _EXFUN(pthread_rwlockattr_init, (pthread_rwlockattr_t *__attr));
332
int     _EXFUN(pthread_rwlockattr_destroy, (pthread_rwlockattr_t *__attr));
333
int     _EXFUN(pthread_rwlockattr_getpshared,
334
        (_CONST pthread_rwlockattr_t *__attr, int *__pshared));
335
int     _EXFUN(pthread_rwlockattr_setpshared,
336
        (pthread_rwlockattr_t *__attr, int __pshared));
337
 
338
int     _EXFUN(pthread_rwlock_init,
339
        (pthread_rwlock_t *__rwlock, _CONST pthread_rwlockattr_t *__attr));
340
int     _EXFUN(pthread_rwlock_destroy, (pthread_rwlock_t *__rwlock));
341
int     _EXFUN(pthread_rwlock_rdlock,(pthread_rwlock_t *__rwlock));
342
int     _EXFUN(pthread_rwlock_tryrdlock,(pthread_rwlock_t *__rwlock));
343
int     _EXFUN(pthread_rwlock_timedrdlock,
344
        (pthread_rwlock_t *__rwlock, _CONST struct timespec *__abstime));
345
int     _EXFUN(pthread_rwlock_unlock,(pthread_rwlock_t *__rwlock));
346
int     _EXFUN(pthread_rwlock_wrlock,(pthread_rwlock_t *__rwlock));
347
int     _EXFUN(pthread_rwlock_trywrlock,(pthread_rwlock_t *__rwlock));
348
int     _EXFUN(pthread_rwlock_timedwrlock,
349
        (pthread_rwlock_t *__rwlock, _CONST struct timespec *__abstime));
350
 
351
#endif /* defined(_POSIX_READER_WRITER_LOCKS) */
352
 
353
 
354
#ifdef __cplusplus
355
}
356
#endif
357
 
358
#endif
359
/* end of include file */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.