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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.18.0/] [newlib/] [libc/] [include/] [pthread.h] - Blame information for rev 258

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 207 jeremybenn
/*  pthread.h
2
 *
3
 *  Written by Joel Sherrill <joel@OARcorp.com>.
4
 *
5
 *  COPYRIGHT (c) 1989-2000.
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 207 2010-07-19 17:43:24Z jeremybennett $
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_getstacksize,
189
        (_CONST pthread_attr_t *__attr, size_t *__stacksize));
190
int     _EXFUN(pthread_attr_setstacksize,
191
        (pthread_attr_t *__attr, size_t stacksize));
192
int     _EXFUN(pthread_attr_getstackaddr,
193
        (_CONST pthread_attr_t *__attr, void **__stackaddr));
194
int     _EXFUN(pthread_attr_setstackaddr,
195
        (pthread_attr_t  *__attr, void *__stackaddr));
196
int     _EXFUN(pthread_attr_getdetachstate,
197
        (_CONST pthread_attr_t *__attr, int *__detachstate));
198
int     _EXFUN(pthread_attr_setdetachstate,
199
        (pthread_attr_t *__attr, int __detachstate));
200
 
201
/* Thread Creation, P1003.1c/Draft 10, p. 144 */
202
 
203
int     _EXFUN(pthread_create,
204
        (pthread_t *__pthread, _CONST pthread_attr_t  *__attr,
205
        void *(*__start_routine)( void * ), void *__arg));
206
 
207
/* Wait for Thread Termination, P1003.1c/Draft 10, p. 147 */
208
 
209
int     _EXFUN(pthread_join, (pthread_t __pthread, void **__value_ptr));
210
 
211
/* Detaching a Thread, P1003.1c/Draft 10, p. 149 */
212
 
213
int     _EXFUN(pthread_detach, (pthread_t __pthread));
214
 
215
/* Thread Termination, p1003.1c/Draft 10, p. 150 */
216
 
217
void    _EXFUN(pthread_exit, (void *__value_ptr));
218
 
219
/* Get Calling Thread's ID, p1003.1c/Draft 10, p. XXX */
220
 
221
pthread_t       _EXFUN(pthread_self, (void));
222
 
223
/* Compare Thread IDs, p1003.1c/Draft 10, p. 153 */
224
 
225
int     _EXFUN(pthread_equal, (pthread_t __t1, pthread_t __t2));
226
 
227
/* Dynamic Package Initialization */
228
 
229
/* This is used to statically initialize a pthread_once_t. Example:
230
 
231
    pthread_once_t once = PTHREAD_ONCE_INIT;
232
 
233
    NOTE:  This is named inconsistently -- it should be INITIALIZER.  */
234
 
235
#define PTHREAD_ONCE_INIT  { 1, 0 }  /* is initialized and not run */
236
 
237
int     _EXFUN(pthread_once,
238
        (pthread_once_t *__once_control, void (*__init_routine)(void)));
239
 
240
/* Thread-Specific Data Key Create, P1003.1c/Draft 10, p. 163 */
241
 
242
int     _EXFUN(pthread_key_create,
243
        (pthread_key_t *__key, void (*__destructor)( void * )));
244
 
245
/* Thread-Specific Data Management, P1003.1c/Draft 10, p. 165 */
246
 
247
int     _EXFUN(pthread_setspecific,
248
        (pthread_key_t __key, _CONST void *__value));
249
void *  _EXFUN(pthread_getspecific, (pthread_key_t __key));
250
 
251
/* Thread-Specific Data Key Deletion, P1003.1c/Draft 10, p. 167 */
252
 
253
int     _EXFUN(pthread_key_delete, (pthread_key_t __key));
254
 
255
/* Execution of a Thread, P1003.1c/Draft 10, p. 181 */
256
 
257
#define PTHREAD_CANCEL_ENABLE  0
258
#define PTHREAD_CANCEL_DISABLE 1
259
 
260
#define PTHREAD_CANCEL_DEFERRED 0
261
#define PTHREAD_CANCEL_ASYNCHRONOUS 1
262
 
263
#define PTHREAD_CANCELED ((void *) -1)
264
 
265
int     _EXFUN(pthread_cancel, (pthread_t __pthread));
266
 
267
/* Setting Cancelability State, P1003.1c/Draft 10, p. 183 */
268
 
269
int     _EXFUN(pthread_setcancelstate, (int __state, int *__oldstate));
270
int     _EXFUN(pthread_setcanceltype, (int __type, int *__oldtype));
271
void    _EXFUN(pthread_testcancel, (void));
272
 
273
/* Establishing Cancellation Handlers, P1003.1c/Draft 10, p. 184 */
274
 
275
void    _EXFUN(pthread_cleanup_push,
276
        (void (*__routine)( void * ), void *__arg));
277
void    _EXFUN(pthread_cleanup_pop, (int __execute));
278
 
279
#if defined(_POSIX_THREAD_CPUTIME)
280
 
281
/* Accessing a Thread CPU-time Clock, P1003.4b/D8, p. 58 */
282
 
283
int     _EXFUN(pthread_getcpuclockid,
284
        (pthread_t __pthread_id, clockid_t *__clock_id));
285
 
286
#endif /* defined(_POSIX_THREAD_CPUTIME) */
287
 
288
 
289
#endif /* defined(_POSIX_THREADS) */
290
 
291
#if defined(_POSIX_BARRIERS)
292
 
293
int     _EXFUN(pthread_barrierattr_init, (pthread_barrierattr_t *__attr));
294
int     _EXFUN(pthread_barrierattr_destroy, (pthread_barrierattr_t *__attr));
295
int     _EXFUN(pthread_barrierattr_getpshared,
296
        (_CONST pthread_barrierattr_t *__attr, int *__pshared));
297
int     _EXFUN(pthread_barrierattr_setpshared,
298
        (pthread_barrierattr_t *__attr, int __pshared));
299
 
300
#define PTHREAD_BARRIER_SERIAL_THREAD -1
301
 
302
int     _EXFUN(pthread_barrier_init,
303
        (pthread_barrier_t *__barrier,
304
        _CONST pthread_barrierattr_t *__attr, unsigned __count));
305
int     _EXFUN(pthread_barrier_destroy, (pthread_barrier_t *__barrier));
306
int     _EXFUN(pthread_barrier_wait,(pthread_barrier_t *__barrier));
307
 
308
#endif /* defined(_POSIX_BARRIERS) */
309
 
310
#if defined(_POSIX_SPIN_LOCKS)
311
 
312
int     _EXFUN(pthread_spin_init,
313
        (pthread_spinlock_t *__spinlock, int __pshared));
314
int     _EXFUN(pthread_spin_destroy, (pthread_spinlock_t *__spinlock));
315
int     _EXFUN(pthread_spin_lock, (pthread_spinlock_t *__spinlock));
316
int     _EXFUN(pthread_spin_trylock, (pthread_spinlock_t *__spinlock));
317
int     _EXFUN(pthread_spin_unlock, (pthread_spinlock_t *__spinlock));
318
 
319
#endif /* defined(_POSIX_SPIN_LOCKS) */
320
 
321
#if defined(_POSIX_READER_WRITER_LOCKS)
322
 
323
int     _EXFUN(pthread_rwlockattr_init, (pthread_rwlockattr_t *__attr));
324
int     _EXFUN(pthread_rwlockattr_destroy, (pthread_rwlockattr_t *__attr));
325
int     _EXFUN(pthread_rwlockattr_getpshared,
326
        (_CONST pthread_rwlockattr_t *__attr, int *__pshared));
327
int     _EXFUN(pthread_rwlockattr_setpshared,
328
        (pthread_rwlockattr_t *__attr, int __pshared));
329
 
330
int     _EXFUN(pthread_rwlock_init,
331
        (pthread_rwlock_t *__rwlock, _CONST pthread_rwlockattr_t *__attr));
332
int     _EXFUN(pthread_rwlock_destroy, (pthread_rwlock_t *__rwlock));
333
int     _EXFUN(pthread_rwlock_rdlock,(pthread_rwlock_t *__rwlock));
334
int     _EXFUN(pthread_rwlock_tryrdlock,(pthread_rwlock_t *__rwlock));
335
int     _EXFUN(pthread_rwlock_timedrdlock,
336
        (pthread_rwlock_t *__rwlock, _CONST struct timespec *__abstime));
337
int     _EXFUN(pthread_rwlock_unlock,(pthread_rwlock_t *__rwlock));
338
int     _EXFUN(pthread_rwlock_wrlock,(pthread_rwlock_t *__rwlock));
339
int     _EXFUN(pthread_rwlock_trywrlock,(pthread_rwlock_t *__rwlock));
340
int     _EXFUN(pthread_rwlock_timedwrlock,
341
        (pthread_rwlock_t *__rwlock, _CONST struct timespec *__abstime));
342
 
343
#endif /* defined(_POSIX_READER_WRITER_LOCKS) */
344
 
345
 
346
#ifdef __cplusplus
347
}
348
#endif
349
 
350
#endif
351
/* end of include file */

powered by: WebSVN 2.1.0

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