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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [newlib-1.17.0/] [newlib/] [libc/] [include/] [pthread.h] - Blame information for rev 816

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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