Add init_SEMAPHORE
PATCH 1/1 Add init_SEMAPHORE
Add init_SEMAPHORE() to dynamically initialize semaphores.
Signed-off-by Samuel Thibault <[email protected]>
extras/mini-os/include/semaphore.h +4 -2
@@ -41,11 +41,13 @@#define DECLARE_MUTEX_LOCKED (name) __DECLARE_SEMAPHORE_GENERIC(name,0) -static inline void init_MUTEX (struct semaphore *sem) +static inline void init_SEMAPHORE (struct semaphore *sem,int count) { - sem->count =1 ; + sem->count = count;init_waitqueue_head (&sem->wait); } +#define init_MUTEX (sem) init_SEMAPHORE(sem, 1) +static void inline down (struct semaphore *sem) {