Changes in uspace/lib/c/include/fibril_synch.h [25f6bddb:bc56f30] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/include/fibril_synch.h
r25f6bddb rbc56f30 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>41 40 #include <time.h> 42 41 #include <stdbool.h> 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; 42 #include <_bits/decls.h> 43 44 #ifndef __cplusplus 49 45 50 46 #define FIBRIL_MUTEX_INITIALIZER(name) \ … … 54 50 }, \ 55 51 .counter = 1, \ 56 .waiters = { \ 57 .head = { \ 58 .prev = &(name).waiters.head, \ 59 .next = &(name).waiters.head, \ 60 } \ 61 } \ 52 .waiters = LIST_INITIALIZER((name).waiters), \ 62 53 } 63 54 64 55 #define FIBRIL_MUTEX_INITIALIZE(name) \ 65 56 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;73 57 74 58 #define FIBRIL_RWLOCK_INITIALIZER(name) \ … … 79 63 .readers = 0, \ 80 64 .writers = 0, \ 81 .waiters = { \ 82 .head = { \ 83 .prev = &(name).waiters.head, \ 84 .next = &(name).waiters.head, \ 85 } \ 86 } \ 65 .waiters = LIST_INITIALIZER((name).waiters), \ 87 66 } 88 67 … … 90 69 fibril_rwlock_t name = FIBRIL_RWLOCK_INITIALIZER(name) 91 70 92 typedef struct {93 list_t waiters;94 } fibril_condvar_t;95 96 71 #define FIBRIL_CONDVAR_INITIALIZER(name) \ 97 72 { \ 98 .waiters = { \ 99 .head = { \ 100 .next = &(name).waiters.head, \ 101 .prev = &(name).waiters.head, \ 102 } \ 103 } \ 73 .waiters = LIST_INITIALIZER((name).waiters), \ 104 74 } 105 75 106 76 #define FIBRIL_CONDVAR_INITIALIZE(name) \ 107 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; 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 166 152 extern void __fibril_synch_init(void); 167 153 extern void __fibril_synch_fini(void); … … 211 197 extern void mpsc_close(mpsc_t *); 212 198 199 __HELENOS_DECLS_END; 200 213 201 #endif 214 202
Note:
See TracChangeset
for help on using the changeset viewer.