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

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [newlib/] [newlib/] [libc/] [sys/] [rtems/] [include/] [pthread.h] - Blame information for rev 1782

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 61 joel
/*  pthread.h
2
 *
3
 *  $Id: pthread.h,v 1.1 2000-09-26 13:17:04 joel Exp $
4
 */
5
 
6
#ifndef __PTHREAD_h
7
#define __PTHREAD_h
8
 
9
#ifdef __cplusplus
10
extern "C" {
11
#endif
12
 
13
#include <sys/features.h>
14
 
15
#if defined(_POSIX_THREADS)
16
 
17
#include <sys/types.h>
18
#include <time.h>
19
#include <sys/sched.h>
20
 
21
/*
22
 *  3.1.3 Register Fork Handlers, P1003.1c/Draft 10, P1003.1c/Draft 10, p. 27
23
 *
24
 *  RTEMS does not support processes, so we fall under this and do not
25
 *  provide this routine:
26
 *
27
 *  "Either the implementation shall support the pthread_atfork() function
28
 *   as described above or the pthread_atfork() funciton shall not be
29
 *   provided."
30
 */
31
 
32
/*
33
 *  11.3.1 Mutex Initialization Attributes, P1003.1c/Draft 10, p. 81
34
 */
35
 
36
int pthread_mutexattr_init(
37
  pthread_mutexattr_t *attr
38
);
39
 
40
int pthread_mutexattr_destroy(
41
  pthread_mutexattr_t *attr
42
);
43
 
44
int pthread_mutexattr_getpshared(
45
  const pthread_mutexattr_t *attr,
46
  int                       *pshared
47
);
48
 
49
int pthread_mutexattr_setpshared(
50
  pthread_mutexattr_t *attr,
51
  int                  pshared
52
);
53
 
54
/*
55
 *  11.3.2 Initializing and Destroying a Mutex, P1003.1c/Draft 10, p. 87
56
 */
57
 
58
int pthread_mutex_init(
59
  pthread_mutex_t           *mutex,
60
  const pthread_mutexattr_t *attr
61
);
62
 
63
int pthread_mutex_destroy(
64
  pthread_mutex_t           *mutex
65
);
66
 
67
/*
68
 *  This is used to statically initialize a pthread_mutex_t. Example:
69
 *
70
 *  pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
71
 */
72
 
73
#define PTHREAD_MUTEX_INITIALIZER  ((pthread_mutex_t) 0xFFFFFFFF)
74
 
75
/*
76
 *  11.3.3 Locking and Unlocking a Mutex, P1003.1c/Draft 10, p. 93
77
 *
78
 *  NOTE: P1003.4b/D8 adds pthread_mutex_timedlock(), p. 29
79
 */
80
 
81
int pthread_mutex_lock(
82
  pthread_mutex_t           *mutex
83
);
84
 
85
int pthread_mutex_trylock(
86
  pthread_mutex_t           *mutex
87
);
88
 
89
int pthread_mutex_unlock(
90
  pthread_mutex_t           *mutex
91
);
92
 
93
#if defined(_POSIX_TIMEOUTS)
94
 
95
int pthread_mutex_timedlock(
96
  pthread_mutex_t       *mutex,
97
  const struct timespec *timeout
98
);
99
 
100
#endif /* _POSIX_TIMEOUTS */
101
 
102
/*
103
 *  11.4.1 Condition Variable Initialization Attributes,
104
 *            P1003.1c/Draft 10, p. 96
105
 */
106
 
107
int pthread_condattr_init(
108
  pthread_condattr_t *attr
109
);
110
 
111
int pthread_condattr_destroy(
112
  pthread_condattr_t *attr
113
);
114
 
115
int pthread_condattr_getpshared(
116
  const pthread_condattr_t *attr,
117
  int                      *pshared
118
);
119
 
120
int pthread_condattr_setpshared(
121
  pthread_condattr_t  *attr,
122
  int                  pshared
123
);
124
 
125
/*
126
 *  11.4.2 Initializing and Destroying a Condition Variable,
127
 *         P1003.1c/Draft 10, p. 87
128
 */
129
 
130
int pthread_cond_init(
131
  pthread_cond_t           *cond,
132
  const pthread_condattr_t *attr
133
);
134
 
135
int pthread_cond_destroy(
136
  pthread_cond_t           *mutex
137
);
138
 
139
/*
140
 *  This is used to statically initialize a pthread_cond_t. Example:
141
 *
142
 *  pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
143
 */
144
 
145
#define PTHREAD_COND_INITIALIZER  ((pthread_mutex_t) 0xFFFFFFFF)
146
 
147
/*
148
 *  11.4.3 Broadcasting and Signaling a Condition, P1003.1c/Draft 10, p. 101
149
 */
150
 
151
int pthread_cond_signal(
152
  pthread_cond_t   *cond
153
);
154
 
155
int pthread_cond_broadcast(
156
  pthread_cond_t   *cond
157
);
158
 
159
/*
160
 *  11.4.4 Waiting on a Condition, P1003.1c/Draft 10, p. 105
161
 */
162
 
163
int pthread_cond_wait(
164
  pthread_cond_t     *cond,
165
  pthread_mutex_t    *mutex
166
);
167
 
168
int pthread_cond_timedwait(
169
  pthread_cond_t        *cond,
170
  pthread_mutex_t       *mutex,
171
  const struct timespec *abstime
172
);
173
 
174
#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING)
175
 
176
/*
177
 *  13.5.1 Thread Creation Scheduling Attributes, P1003.1c/Draft 10, p. 120
178
 */
179
 
180
int pthread_attr_setscope(
181
  pthread_attr_t  *attr,
182
  int              contentionscope
183
);
184
 
185
int pthread_attr_getscope(
186
  const pthread_attr_t  *attr,
187
  int                   *contentionscope
188
);
189
 
190
int pthread_attr_setinheritsched(
191
  pthread_attr_t  *attr,
192
  int              inheritsched
193
);
194
 
195
int pthread_attr_getinheritsched(
196
  const pthread_attr_t  *attr,
197
  int                   *inheritsched
198
);
199
 
200
int pthread_attr_setschedpolicy(
201
  pthread_attr_t  *attr,
202
  int              policy
203
);
204
 
205
int pthread_attr_getschedpolicy(
206
  const pthread_attr_t  *attr,
207
  int                   *policy
208
);
209
 
210
#endif /* defined(_POSIX_THREAD_PRIORITY_SCHEDULING) */
211
 
212
int pthread_attr_setschedparam(
213
  pthread_attr_t            *attr,
214
  const struct sched_param  *param
215
);
216
 
217
int pthread_attr_getschedparam(
218
  const pthread_attr_t  *attr,
219
  struct sched_param    *param
220
);
221
 
222
#if defined(_POSIX_THREAD_PRIORITY_SCHEDULING)
223
 
224
/*
225
 *  13.5.2 Dynamic Thread Scheduling Parameters Access,
226
 *         P1003.1c/Draft 10, p. 124
227
 */
228
 
229
int pthread_getschedparam(
230
  pthread_t           thread,
231
  int                *policy,
232
  struct sched_param *param
233
);
234
 
235
int pthread_setschedparam(
236
  pthread_t           thread,
237
  int                 policy,
238
  struct sched_param *param
239
);
240
 
241
#endif /* defined(_POSIX_THREAD_PRIORITY_SCHEDULING) */
242
 
243
#if defined(_POSIX_THREAD_PRIO_INHERIT) || defined(_POSIX_THREAD_PRIO_PROTECT)
244
 
245
/*
246
 *  13.6.1 Mutex Initialization Scheduling Attributes, P1003.1c/Draft 10, p. 128
247
 */
248
 
249
int pthread_mutexattr_setprotocol(
250
  pthread_mutexattr_t   *attr,
251
  int                    protocol
252
);
253
 
254
int pthread_mutexattr_getprotocol(
255
  const pthread_mutexattr_t   *attr,
256
  int                         *protocol
257
);
258
 
259
int pthread_mutexattr_setprioceiling(
260
  pthread_mutexattr_t   *attr,
261
  int                    prioceiling
262
);
263
 
264
int pthread_mutexattr_getprioceiling(
265
  const pthread_mutexattr_t   *attr,
266
  int                         *prioceiling
267
);
268
 
269
#endif /* _POSIX_THREAD_PRIO_INHERIT || _POSIX_THREAD_PRIO_PROTECT */
270
 
271
#if defined(_POSIX_THREAD_PRIO_PROTECT)
272
 
273
/*
274
 *  13.6.2 Change the Priority Ceiling of a Mutex, P1003.1c/Draft 10, p. 131
275
 */
276
 
277
int pthread_mutex_setprioceiling(
278
  pthread_mutex_t   *mutex,
279
  int                prioceiling,
280
  int               *old_ceiling
281
);
282
 
283
int pthread_mutex_getprioceiling(
284
  pthread_mutex_t   *mutex,
285
  int               *prioceiling
286
);
287
 
288
#endif /* _POSIX_THREAD_PRIO_PROTECT */
289
 
290
/*
291
 *  16.1.1 Thread Creation Attributes, P1003.1c/Draft 10, p, 140
292
 */
293
 
294
int pthread_attr_init(
295
  pthread_attr_t  *attr
296
);
297
 
298
int pthread_attr_destroy(
299
  pthread_attr_t  *attr
300
);
301
 
302
int pthread_attr_getstacksize(
303
  const pthread_attr_t  *attr,
304
  size_t                *stacksize
305
);
306
 
307
int pthread_attr_setstacksize(
308
  pthread_attr_t  *attr,
309
  size_t           stacksize
310
);
311
 
312
int pthread_attr_getstackaddr(
313
  const pthread_attr_t   *attr,
314
  void                  **stackaddr
315
);
316
 
317
int pthread_attr_setstackaddr(
318
  pthread_attr_t  *attr,
319
  void            *stackaddr
320
);
321
 
322
int pthread_attr_getdetachstate(
323
  const pthread_attr_t  *attr,
324
  int                   *detachstate
325
);
326
 
327
int pthread_attr_setdetachstate(
328
  pthread_attr_t  *attr,
329
  int              detachstate
330
);
331
 
332
/*
333
 *  16.1.2 Thread Creation, P1003.1c/Draft 10, p. 144
334
 */
335
 
336
int pthread_create(
337
  pthread_t              *thread,
338
  const pthread_attr_t   *attr,
339
  void                 *(*start_routine)( void * ),
340
  void                   *arg
341
);
342
 
343
/*
344
 *  16.1.3 Wait for Thread Termination, P1003.1c/Draft 10, p. 147
345
 */
346
 
347
int pthread_join(
348
  pthread_t   thread,
349
  void      **value_ptr
350
);
351
 
352
/*
353
 *  16.1.4 Detaching a Thread, P1003.1c/Draft 10, p. 149
354
 */
355
 
356
int pthread_detach(
357
  pthread_t   thread
358
);
359
 
360
/*
361
 * 16.1.5.1 Thread Termination, p1003.1c/Draft 10, p. 150
362
 */
363
 
364
void pthread_exit(
365
  void  *value_ptr
366
);
367
 
368
/*
369
 * 16.1.6 Get Calling Thread's ID, p1003.1c/Draft 10, p. XXX
370
 */
371
 
372
pthread_t pthread_self( void );
373
 
374
/*
375
 *  16.1.7 Compare Thread IDs, p1003.1c/Draft 10, p. 153
376
 */
377
 
378
int pthread_equal(
379
  pthread_t  t1,
380
  pthread_t  t2
381
);
382
 
383
/*
384
 *  16.1.8 Dynamic Package Initialization
385
 */
386
 
387
/*
388
 *  This is used to statically initialize a pthread_once_t. Example:
389
 *
390
 *  pthread_once_t once = PTHREAD_ONCE_INIT;
391
 *
392
 *  NOTE:  This is named inconsistently -- it should be INITIALIZER.
393
 */
394
 
395
#define PTHREAD_ONCE_INIT  { 1, 0 }  /* is initialized and not run */
396
 
397
int pthread_once(
398
  pthread_once_t  *once_control,
399
  void           (*init_routine)(void)
400
);
401
 
402
/*
403
 *  17.1.1 Thread-Specific Data Key Create, P1003.1c/Draft 10, p. 163
404
 */
405
 
406
int pthread_key_create(
407
  pthread_key_t  *key,
408
  void          (*destructor)( void * )
409
);
410
 
411
/*
412
 *  17.1.2 Thread-Specific Data Management, P1003.1c/Draft 10, p. 165
413
 */
414
 
415
int pthread_setspecific(
416
  pthread_key_t  key,
417
  const void    *value
418
);
419
 
420
void *pthread_getspecific(
421
  pthread_key_t  key
422
);
423
 
424
/*
425
 *  17.1.3 Thread-Specific Data Key Deletion, P1003.1c/Draft 10, p. 167
426
 */
427
 
428
int pthread_key_delete(
429
  pthread_key_t  key
430
);
431
 
432
/*
433
 *  18.2.1 Canceling Execution of a Thread, P1003.1c/Draft 10, p. 181
434
 */
435
 
436
#define PTHREAD_CANCEL_ENABLE  0
437
#define PTHREAD_CANCEL_DISABLE 1
438
 
439
#define PTHREAD_CANCEL_DEFERRED 0
440
#define PTHREAD_CANCEL_ASYNCHRONOUS 1
441
 
442
int pthread_cancel(
443
  pthread_t  thread
444
);
445
 
446
/*
447
 *  18.2.2 Setting Cancelability State, P1003.1c/Draft 10, p. 183
448
 */
449
 
450
int pthread_setcancelstate(
451
  int  state,
452
  int *oldstate
453
);
454
 
455
int pthread_setcanceltype(
456
  int  type,
457
  int *oldtype
458
);
459
 
460
void pthread_testcancel( void );
461
 
462
/*
463
 *  18.2.3.1 Establishing Cancellation Handlers, P1003.1c/Draft 10, p. 184
464
 */
465
 
466
void pthread_cleanup_push(
467
  void   (*routine)( void * ),
468
  void    *arg
469
);
470
 
471
void pthread_cleanup_pop(
472
  int    execute
473
);
474
 
475
#if defined(_POSIX_THREAD_CPUTIME)
476
 
477
/*
478
 *  20.1.6 Accessing a Thread CPU-time Clock, P1003.4b/D8, p. 58
479
 */
480
 
481
int pthread_getcpuclockid(
482
  pthread_t  thread_id,
483
  clockid_t *clock_id
484
);
485
 
486
/*
487
 *  20.1.7 CPU-time Clock Thread Creation Attribute, P1003.4b/D8, p. 59
488
 */
489
 
490
int pthread_attr_setcputime(
491
  pthread_attr_t  *attr,
492
  int              clock_allowed
493
);
494
 
495
int pthread_attr_getcputime(
496
  pthread_attr_t  *attr,
497
  int             *clock_allowed
498
);
499
 
500
#endif /* defined(_POSIX_THREAD_CPUTIME) */
501
 
502
#endif /* defined(_POSIX_THREADS) */
503
 
504
#ifdef __cplusplus
505
}
506
#endif
507
 
508
#endif
509
/* end of include file */

powered by: WebSVN 2.1.0

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