Changeset da1bafb in mainline for kernel/generic/src/synch/semaphore.c
- Timestamp:
- 2010-05-24T18:57:31Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0095368
- Parents:
- 666f492
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/synch/semaphore.c
r666f492 rda1bafb 33 33 /** 34 34 * @file 35 * @brief 35 * @brief Semaphores. 36 36 */ 37 37 … … 47 47 * Initialize semaphore. 48 48 * 49 * @param s Semaphore.49 * @param sem Semaphore. 50 50 * @param val Maximal number of threads allowed to enter critical section. 51 * 51 52 */ 52 void semaphore_initialize(semaphore_t *s , int val)53 void semaphore_initialize(semaphore_t *sem, int val) 53 54 { 54 ipl_t ipl;55 waitq_initialize(&sem->wq); 55 56 56 waitq_initialize(&s->wq); 57 58 ipl = interrupts_disable(); 59 60 spinlock_lock(&s->wq.lock); 61 s->wq.missed_wakeups = val; 62 spinlock_unlock(&s->wq.lock); 63 64 interrupts_restore(ipl); 57 irq_spinlock_lock(&sem->wq.lock, true); 58 sem->wq.missed_wakeups = val; 59 irq_spinlock_unlock(&sem->wq.lock, true); 65 60 } 66 61 … … 70 65 * Conditional mode and mode with timeout can be requested. 71 66 * 72 * @param s Semaphore.73 * @param usec Timeout in microseconds.67 * @param sem Semaphore. 68 * @param usec Timeout in microseconds. 74 69 * @param flags Select mode of operation. 75 70 * … … 78 73 * 79 74 * @return See comment for waitq_sleep_timeout(). 75 * 80 76 */ 81 int _semaphore_down_timeout(semaphore_t *s , uint32_t usec,int flags)77 int _semaphore_down_timeout(semaphore_t *sem, uint32_t usec, unsigned int flags) 82 78 { 83 return waitq_sleep_timeout(&s ->wq, usec, flags);79 return waitq_sleep_timeout(&sem->wq, usec, flags); 84 80 } 85 81 … … 89 85 * 90 86 * @param s Semaphore. 87 * 91 88 */ 92 void semaphore_up(semaphore_t *s )89 void semaphore_up(semaphore_t *sem) 93 90 { 94 waitq_wakeup(&s ->wq, WAKEUP_FIRST);91 waitq_wakeup(&sem->wq, WAKEUP_FIRST); 95 92 } 96 93
Note:
See TracChangeset
for help on using the changeset viewer.