Changes in uspace/lib/c/include/fibril_synch.h [bc56f30:4805495] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/include/fibril_synch.h
rbc56f30 r4805495 40 40 #include <time.h> 41 41 #include <stdbool.h> 42 #include <_bits/decls.h>43 42 44 #ifndef __cplusplus 43 typedef struct { 44 fibril_owner_info_t oi; /**< Keep this the first thing. */ 45 int counter; 46 list_t waiters; 47 } fibril_mutex_t; 45 48 46 49 #define FIBRIL_MUTEX_INITIALIZER(name) \ … … 55 58 #define FIBRIL_MUTEX_INITIALIZE(name) \ 56 59 fibril_mutex_t name = FIBRIL_MUTEX_INITIALIZER(name) 60 61 typedef struct { 62 fibril_owner_info_t oi; /**< Keep this the first thing. */ 63 unsigned int writers; 64 unsigned int readers; 65 list_t waiters; 66 } fibril_rwlock_t; 57 67 58 68 #define FIBRIL_RWLOCK_INITIALIZER(name) \ … … 69 79 fibril_rwlock_t name = FIBRIL_RWLOCK_INITIALIZER(name) 70 80 81 typedef struct { 82 list_t waiters; 83 } fibril_condvar_t; 84 71 85 #define FIBRIL_CONDVAR_INITIALIZER(name) \ 72 86 { \ … … 76 90 #define FIBRIL_CONDVAR_INITIALIZE(name) \ 77 91 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 92 109 93 typedef void (*fibril_timer_fun_t)(void *); … … 149 133 bool closed; 150 134 } fibril_semaphore_t; 135 136 #define FIBRIL_SEMAPHORE_INITIALIZER(name, cnt) \ 137 { \ 138 .count = (cnt), \ 139 .waiters = LIST_INITIALIZER((name).waiters), \ 140 } 141 142 #define FIBRIL_SEMAPHORE_INITIALIZE(name, cnt) \ 143 fibril_semaphore_t name = FIBRIL_SEMAPHORE_INITIALIZER(name, cnt) 151 144 152 145 extern void __fibril_synch_init(void); … … 197 190 extern void mpsc_close(mpsc_t *); 198 191 199 __HELENOS_DECLS_END;200 201 192 #endif 202 193
Note:
See TracChangeset
for help on using the changeset viewer.