Commit | Line | Data |
---|---|---|
90269d47 AM |
1 | /* ==== cond.h ============================================================ |
2 | * Copyright (c) 1993 by Chris Provenzano, proven@athena.mit.edu | |
3 | * | |
4 | * Description : mutex header. | |
5 | * | |
6 | * 1.00 93/10/30 proven | |
7 | * -Started coding this file. | |
8 | */ | |
9 | ||
10 | /* | |
11 | * New cond structures | |
12 | */ | |
13 | enum pthread_cond_type { | |
14 | COND_TYPE_FAST, | |
15 | COND_TYPE_STATIC_FAST, | |
16 | COND_TYPE_METERED, | |
17 | COND_TYPE_DEBUG, /* Debug conds will have lots of options */ | |
18 | COND_TYPE_MAX | |
19 | }; | |
20 | ||
21 | typedef struct pthread_cond { | |
22 | enum pthread_cond_type c_type; | |
23 | struct pthread_queue c_queue; | |
24 | semaphore c_lock; | |
25 | void * c_data; | |
26 | long c_flags; | |
27 | } pthread_cond_t; | |
28 | ||
29 | typedef struct pthread_cond_attr { | |
30 | enum pthread_cond_type c_type; | |
31 | long c_flags; | |
32 | } pthread_condattr_t; | |
33 | ||
34 | /* | |
35 | * Flags for conds. | |
36 | */ | |
37 | #define COND_FLAGS_PRIVATE 0x01 | |
38 | #define COND_FLAGS_INITED 0x02 | |
39 | #define COND_FLAGS_BUSY 0x04 | |
40 | ||
41 | /* | |
42 | * Static cond initialization values. | |
43 | */ | |
44 | #define PTHREAD_COND_INITIALIZER \ | |
45 | { COND_TYPE_STATIC_FAST, PTHREAD_QUEUE_INITIALIZER, \ | |
46 | NULL, SEMAPHORE_CLEAR, COND_FLAGS_INITED } | |
47 | ||
48 | /* | |
49 | * New functions | |
50 | */ | |
51 | ||
52 | __BEGIN_DECLS | |
53 | ||
54 | int pthread_cond_init __P((pthread_cond_t *, pthread_condattr_t *)); | |
55 | int pthread_cond_wait __P((pthread_cond_t *, pthread_mutex_t *)); | |
56 | int pthread_cond_signal __P((pthread_cond_t *)); | |
57 | int pthread_cond_broadcast __P((pthread_cond_t *)); | |
58 | int pthread_cond_destroy __P((pthread_cond_t *)); | |
59 | ||
60 | __END_DECLS | |
61 |