Changeset bc56f30 in mainline for uspace/lib/c/include/fibril_synch.h
- Timestamp:
- 2019-05-27T12:38:26Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0d14c25
- Parents:
- 4d51c60
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2019-02-13 16:06:49)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2019-05-27 12:38:26)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/include/fibril_synch.h
r4d51c60 rbc56f30 40 40 #include <time.h> 41 41 #include <stdbool.h> 42 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; 42 #include <_bits/decls.h> 43 44 #ifndef __cplusplus 48 45 49 46 #define FIBRIL_MUTEX_INITIALIZER(name) \ … … 58 55 #define FIBRIL_MUTEX_INITIALIZE(name) \ 59 56 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;67 57 68 58 #define FIBRIL_RWLOCK_INITIALIZER(name) \ … … 79 69 fibril_rwlock_t name = FIBRIL_RWLOCK_INITIALIZER(name) 80 70 81 typedef struct {82 list_t waiters;83 } fibril_condvar_t;84 85 71 #define FIBRIL_CONDVAR_INITIALIZER(name) \ 86 72 { \ … … 90 76 #define FIBRIL_CONDVAR_INITIALIZE(name) \ 91 77 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 #endif 89 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; 92 108 93 109 typedef void (*fibril_timer_fun_t)(void *); … … 134 150 } fibril_semaphore_t; 135 151 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)144 145 152 extern void __fibril_synch_init(void); 146 153 extern void __fibril_synch_fini(void); … … 190 197 extern void mpsc_close(mpsc_t *); 191 198 199 __HELENOS_DECLS_END; 200 192 201 #endif 193 202
Note:
See TracChangeset
for help on using the changeset viewer.