Changeset da1bafb in mainline for kernel/generic/include/synch
- Timestamp:
- 2010-05-24T18:57:31Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0095368
- Parents:
- 666f492
- Location:
- kernel/generic/include/synch
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/synch/mutex.h
r666f492 rda1bafb 50 50 } mutex_t; 51 51 52 #define mutex_lock(mtx) 52 #define mutex_lock(mtx) \ 53 53 _mutex_lock_timeout((mtx), SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NONE) 54 #define mutex_trylock(mtx) \ 54 55 #define mutex_trylock(mtx) \ 55 56 _mutex_lock_timeout((mtx), SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NON_BLOCKING) 56 #define mutex_lock_timeout(mtx, usec) \ 57 58 #define mutex_lock_timeout(mtx, usec) \ 57 59 _mutex_lock_timeout((mtx), (usec), SYNCH_FLAGS_NON_BLOCKING) 58 60 59 61 extern void mutex_initialize(mutex_t *, mutex_type_t); 60 extern int _mutex_lock_timeout(mutex_t *, uint32_t, int);62 extern int _mutex_lock_timeout(mutex_t *, uint32_t, unsigned int); 61 63 extern void mutex_unlock(mutex_t *); 62 64 -
kernel/generic/include/synch/rwlock.h
r666f492 rda1bafb 48 48 49 49 typedef struct { 50 SPINLOCK_DECLARE(lock); 50 IRQ_SPINLOCK_DECLARE(lock); 51 51 52 /** 52 53 * Mutex for writers, readers can bypass it if readers_in is positive. 54 * 53 55 */ 54 56 mutex_t exclusive; 57 55 58 /** Number of readers in critical section. */ 56 59 size_t readers_in; … … 59 62 #define rwlock_write_lock(rwl) \ 60 63 _rwlock_write_lock_timeout((rwl), SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NONE) 64 61 65 #define rwlock_read_lock(rwl) \ 62 66 _rwlock_read_lock_timeout((rwl), SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NONE) 67 63 68 #define rwlock_write_trylock(rwl) \ 64 69 _rwlock_write_lock_timeout((rwl), SYNCH_NO_TIMEOUT, \ 65 70 SYNCH_FLAGS_NON_BLOCKING) 71 66 72 #define rwlock_read_trylock(rwl) \ 67 73 _rwlock_read_lock_timeout((rwl), SYNCH_NO_TIMEOUT, \ 68 74 SYNCH_FLAGS_NON_BLOCKING) 75 69 76 #define rwlock_write_lock_timeout(rwl, usec) \ 70 77 _rwlock_write_lock_timeout((rwl), (usec), SYNCH_FLAGS_NONE) 78 71 79 #define rwlock_read_lock_timeout(rwl, usec) \ 72 80 _rwlock_read_lock_timeout((rwl), (usec), SYNCH_FLAGS_NONE) 73 81 74 extern void rwlock_initialize(rwlock_t * rwl);75 extern void rwlock_read_unlock(rwlock_t * rwl);76 extern void rwlock_write_unlock(rwlock_t * rwl);77 extern int _rwlock_read_lock_timeout(rwlock_t * rwl, uint32_t usec, int flags);78 extern int _rwlock_write_lock_timeout(rwlock_t * rwl, uint32_t usec, int flags);82 extern void rwlock_initialize(rwlock_t *); 83 extern void rwlock_read_unlock(rwlock_t *); 84 extern void rwlock_write_unlock(rwlock_t *); 85 extern int _rwlock_read_lock_timeout(rwlock_t *, uint32_t, unsigned int); 86 extern int _rwlock_write_lock_timeout(rwlock_t *, uint32_t, unsigned int); 79 87 80 88 #endif -
kernel/generic/include/synch/semaphore.h
r666f492 rda1bafb 46 46 #define semaphore_down(s) \ 47 47 _semaphore_down_timeout((s), SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NONE) 48 48 49 #define semaphore_trydown(s) \ 49 50 _semaphore_down_timeout((s), SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NON_BLOCKING) 51 50 52 #define semaphore_down_timeout(s, usec) \ 51 53 _semaphore_down_timeout((s), (usec), SYNCH_FLAGS_NONE) 52 54 53 extern void semaphore_initialize(semaphore_t * s, int val);54 extern int _semaphore_down_timeout(semaphore_t * s, uint32_t usec, int flags);55 extern void semaphore_up(semaphore_t * s);55 extern void semaphore_initialize(semaphore_t *, int); 56 extern int _semaphore_down_timeout(semaphore_t *, uint32_t, unsigned int); 57 extern void semaphore_up(semaphore_t *); 56 58 57 59 #endif -
kernel/generic/include/synch/spinlock.h
r666f492 rda1bafb 170 170 #define SPINLOCK_STATIC_INITIALIZE_NAME(name, desc_name) 171 171 172 #define ASSERT_SPINLOCK(expr, lock) 172 #define ASSERT_SPINLOCK(expr, lock) ASSERT(expr) 173 173 174 174 #define spinlock_initialize(lock, name) -
kernel/generic/include/synch/waitq.h
r666f492 rda1bafb 46 46 } wakeup_mode_t; 47 47 48 /** Wait queue structure. */ 48 /** Wait queue structure. 49 * 50 */ 49 51 typedef struct { 50 51 52 /** Lock protecting wait queue structure. 52 53 * 53 54 * Must be acquired before T.lock for each T of type thread_t. 54 55 */ 55 SPINLOCK_DECLARE(lock);56 56 IRQ_SPINLOCK_DECLARE(lock); 57 57 58 /** 58 59 * Number of waitq_wakeup() calls that didn't find a thread to wake up. 60 * 59 61 */ 60 62 int missed_wakeups; 63 61 64 /** List of sleeping threads for wich there was no missed_wakeup. */ 62 65 link_t head; … … 69 72 70 73 extern void waitq_initialize(waitq_t *); 71 extern int waitq_sleep_timeout(waitq_t *, uint32_t, int);74 extern int waitq_sleep_timeout(waitq_t *, uint32_t, unsigned int); 72 75 extern ipl_t waitq_sleep_prepare(waitq_t *); 73 extern int waitq_sleep_timeout_unsafe(waitq_t *, uint32_t, int);76 extern int waitq_sleep_timeout_unsafe(waitq_t *, uint32_t, unsigned int); 74 77 extern void waitq_sleep_finish(waitq_t *, int, ipl_t); 75 78 extern void waitq_wakeup(waitq_t *, wakeup_mode_t);
Note:
See TracChangeset
for help on using the changeset viewer.