Changeset 04803bf in mainline for uspace/lib/c/include/fibril_synch.h
- Timestamp:
- 2011-03-21T22:00:17Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 143932e3
- Parents:
- b50b5af2 (diff), 7308e84 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/include/fibril_synch.h
rb50b5af2 r04803bf 33 33 */ 34 34 35 #ifndef LIBC_FIBRIL_SYNC _H_36 #define LIBC_FIBRIL_SYNC _H_35 #ifndef LIBC_FIBRIL_SYNCH_H_ 36 #define LIBC_FIBRIL_SYNCH_H_ 37 37 38 38 #include <async.h> … … 40 40 #include <adt/list.h> 41 41 #include <libarch/tls.h> 42 #include <sys/time.h> 42 43 43 44 typedef struct { 45 fibril_owner_info_t oi; /* Keep this the first thing. */ 44 46 int counter; 45 47 link_t waiters; 46 48 } fibril_mutex_t; 47 49 48 #define FIBRIL_MUTEX_INITIALIZE(name) \ 49 fibril_mutex_t name = { \ 50 #define FIBRIL_MUTEX_INITIALIZER(name) \ 51 { \ 52 .oi = { \ 53 .owned_by = NULL \ 54 }, \ 50 55 .counter = 1, \ 51 56 .waiters = { \ … … 54 59 } \ 55 60 } 61 62 #define FIBRIL_MUTEX_INITIALIZE(name) \ 63 fibril_mutex_t name = FIBRIL_MUTEX_INITIALIZER(name) 56 64 57 65 typedef struct { 66 fibril_owner_info_t oi; /* Keep this the first thing. */ 58 67 unsigned writers; 59 68 unsigned readers; … … 61 70 } fibril_rwlock_t; 62 71 63 #define FIBRIL_RWLOCK_INITIALIZE(name) \ 64 fibril_rwlock_t name = { \ 72 #define FIBRIL_RWLOCK_INITIALIZER(name) \ 73 { \ 74 .oi = { \ 75 .owned_by = NULL \ 76 }, \ 65 77 .readers = 0, \ 66 78 .writers = 0, \ … … 71 83 } 72 84 85 #define FIBRIL_RWLOCK_INITIALIZE(name) \ 86 fibril_rwlock_t name = FIBRIL_RWLOCK_INITIALIZER(name) 87 73 88 typedef struct { 74 89 link_t waiters; 75 90 } fibril_condvar_t; 76 91 77 #define FIBRIL_CONDVAR_INITIALIZE (name) \78 fibril_condvar_t name ={ \92 #define FIBRIL_CONDVAR_INITIALIZER(name) \ 93 { \ 79 94 .waiters = { \ 80 95 .next = &name.waiters, \ … … 83 98 } 84 99 100 #define FIBRIL_CONDVAR_INITIALIZE(name) \ 101 fibril_condvar_t name = FIBRIL_CONDVAR_INITIALIZER(name) 102 85 103 extern void fibril_mutex_initialize(fibril_mutex_t *); 86 104 extern void fibril_mutex_lock(fibril_mutex_t *); 87 105 extern bool fibril_mutex_trylock(fibril_mutex_t *); 88 106 extern void fibril_mutex_unlock(fibril_mutex_t *); 107 extern bool fibril_mutex_is_locked(fibril_mutex_t *); 89 108 90 109 extern void fibril_rwlock_initialize(fibril_rwlock_t *); … … 93 112 extern void fibril_rwlock_read_unlock(fibril_rwlock_t *); 94 113 extern void fibril_rwlock_write_unlock(fibril_rwlock_t *); 114 extern bool fibril_rwlock_is_read_locked(fibril_rwlock_t *); 115 extern bool fibril_rwlock_is_write_locked(fibril_rwlock_t *); 116 extern bool fibril_rwlock_is_locked(fibril_rwlock_t *); 95 117 96 118 extern void fibril_condvar_initialize(fibril_condvar_t *); 119 extern int fibril_condvar_wait_timeout(fibril_condvar_t *, fibril_mutex_t *, 120 suseconds_t); 97 121 extern void fibril_condvar_wait(fibril_condvar_t *, fibril_mutex_t *); 98 122 extern void fibril_condvar_signal(fibril_condvar_t *);
Note:
See TracChangeset
for help on using the changeset viewer.