Changes in uspace/lib/c/include/fibril_synch.h [bc56f30:25f6bddb] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/include/fibril_synch.h
rbc56f30 r25f6bddb 33 33 */ 34 34 35 #ifndef _LIBC_FIBRIL_SYNCH_H_36 #define _LIBC_FIBRIL_SYNCH_H_35 #ifndef LIBC_FIBRIL_SYNCH_H_ 36 #define LIBC_FIBRIL_SYNCH_H_ 37 37 38 38 #include <fibril.h> 39 39 #include <adt/list.h> 40 #include <tls.h> 40 41 #include <time.h> 41 42 #include <stdbool.h> 42 #include <_bits/decls.h> 43 44 #ifndef __cplusplus 43 44 typedef struct { 45 fibril_owner_info_t oi; /**< Keep this the first thing. */ 46 int counter; 47 list_t waiters; 48 } fibril_mutex_t; 45 49 46 50 #define FIBRIL_MUTEX_INITIALIZER(name) \ … … 50 54 }, \ 51 55 .counter = 1, \ 52 .waiters = LIST_INITIALIZER((name).waiters), \ 56 .waiters = { \ 57 .head = { \ 58 .prev = &(name).waiters.head, \ 59 .next = &(name).waiters.head, \ 60 } \ 61 } \ 53 62 } 54 63 55 64 #define FIBRIL_MUTEX_INITIALIZE(name) \ 56 65 fibril_mutex_t name = FIBRIL_MUTEX_INITIALIZER(name) 66 67 typedef struct { 68 fibril_owner_info_t oi; /**< Keep this the first thing. */ 69 unsigned int writers; 70 unsigned int readers; 71 list_t waiters; 72 } fibril_rwlock_t; 57 73 58 74 #define FIBRIL_RWLOCK_INITIALIZER(name) \ … … 63 79 .readers = 0, \ 64 80 .writers = 0, \ 65 .waiters = LIST_INITIALIZER((name).waiters), \ 81 .waiters = { \ 82 .head = { \ 83 .prev = &(name).waiters.head, \ 84 .next = &(name).waiters.head, \ 85 } \ 86 } \ 66 87 } 67 88 … … 69 90 fibril_rwlock_t name = FIBRIL_RWLOCK_INITIALIZER(name) 70 91 92 typedef struct { 93 list_t waiters; 94 } fibril_condvar_t; 95 71 96 #define FIBRIL_CONDVAR_INITIALIZER(name) \ 72 97 { \ 73 .waiters = LIST_INITIALIZER((name).waiters), \ 98 .waiters = { \ 99 .head = { \ 100 .next = &(name).waiters.head, \ 101 .prev = &(name).waiters.head, \ 102 } \ 103 } \ 74 104 } 75 105 76 106 #define FIBRIL_CONDVAR_INITIALIZE(name) \ 77 107 fibril_condvar_t name = FIBRIL_CONDVAR_INITIALIZER(name) 78 79 #define FIBRIL_SEMAPHORE_INITIALIZER(name, cnt) \80 { \81 .count = (cnt), \82 .waiters = LIST_INITIALIZER((name).waiters), \83 }84 85 #define FIBRIL_SEMAPHORE_INITIALIZE(name, cnt) \86 fibril_semaphore_t name = FIBRIL_SEMAPHORE_INITIALIZER(name, cnt)87 88 #endif89 90 __HELENOS_DECLS_BEGIN;91 92 typedef struct {93 fibril_owner_info_t oi; /**< Keep this the first thing. */94 int counter;95 list_t waiters;96 } fibril_mutex_t;97 98 typedef struct {99 fibril_owner_info_t oi; /**< Keep this the first thing. */100 unsigned int writers;101 unsigned int readers;102 list_t waiters;103 } fibril_rwlock_t;104 105 typedef struct {106 list_t waiters;107 } fibril_condvar_t;108 108 109 109 typedef void (*fibril_timer_fun_t)(void *); … … 150 150 } fibril_semaphore_t; 151 151 152 #define FIBRIL_SEMAPHORE_INITIALIZER(name, cnt) \ 153 { \ 154 .count = (cnt), \ 155 .waiters = { \ 156 .head = { \ 157 .next = &(name).waiters.head, \ 158 .prev = &(name).waiters.head, \ 159 } \ 160 } \ 161 } 162 163 #define FIBRIL_SEMAPHORE_INITIALIZE(name, cnt) \ 164 fibril_semaphore_t name = FIBRIL_SEMAPHORE_INITIALIZER(name, cnt) 165 152 166 extern void __fibril_synch_init(void); 153 167 extern void __fibril_synch_fini(void); … … 197 211 extern void mpsc_close(mpsc_t *); 198 212 199 __HELENOS_DECLS_END;200 201 213 #endif 202 214
Note:
See TracChangeset
for help on using the changeset viewer.