Changeset 80bcaed in mainline for kernel/generic/include/synch/rwlock.h
- Timestamp:
- 2007-02-03T13:22:24Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f619ec11
- Parents:
- fa8e7d2
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/synch/rwlock.h
rfa8e7d2 r80bcaed 49 49 typedef struct { 50 50 SPINLOCK_DECLARE(lock); 51 mutex_t exclusive; /**< Mutex for writers, readers can bypass it if readers_in is positive. */ 52 count_t readers_in; /**< Number of readers in critical section. */ 51 /** 52 * Mutex for writers, readers can bypass it if readers_in is positive. 53 */ 54 mutex_t exclusive; 55 /** Number of readers in critical section. */ 56 count_t readers_in; 53 57 } rwlock_t; 54 58 55 59 #define rwlock_write_lock(rwl) \ 56 _rwlock_write_lock_timeout((rwl), SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NONE)60 _rwlock_write_lock_timeout((rwl), SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NONE) 57 61 #define rwlock_read_lock(rwl) \ 58 _rwlock_read_lock_timeout((rwl), SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NONE)62 _rwlock_read_lock_timeout((rwl), SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NONE) 59 63 #define rwlock_write_trylock(rwl) \ 60 _rwlock_write_lock_timeout((rwl),SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NON_BLOCKING) 64 _rwlock_write_lock_timeout((rwl), SYNCH_NO_TIMEOUT, \ 65 SYNCH_FLAGS_NON_BLOCKING) 61 66 #define rwlock_read_trylock(rwl) \ 62 _rwlock_read_lock_timeout((rwl),SYNCH_NO_TIMEOUT,SYNCH_FLAGS_NON_BLOCKING) 63 #define rwlock_write_lock_timeout(rwl,usec) \ 64 _rwlock_write_lock_timeout((rwl),(usec),SYNCH_FLAGS_NONE) 65 #define rwlock_read_lock_timeout(rwl,usec) \ 66 _rwlock_read_lock_timeout((rwl),(usec),SYNCH_FLAGS_NONE) 67 _rwlock_read_lock_timeout((rwl), SYNCH_NO_TIMEOUT, \ 68 SYNCH_FLAGS_NON_BLOCKING) 69 #define rwlock_write_lock_timeout(rwl, usec) \ 70 _rwlock_write_lock_timeout((rwl), (usec), SYNCH_FLAGS_NONE) 71 #define rwlock_read_lock_timeout(rwl, usec) \ 72 _rwlock_read_lock_timeout((rwl), (usec), SYNCH_FLAGS_NONE) 67 73 68 74 extern void rwlock_initialize(rwlock_t *rwl);
Note:
See TracChangeset
for help on using the changeset viewer.