ia64/xen-unstable

changeset 16442:ebb61551565b

[Mini-OS] Add init_SEMAPHORE

Add init_SEMAPHORE() to dynamically initialize semaphores.

Signed-off-by: Samuel Thibault <samuel.thibault@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Sat Nov 24 13:27:08 2007 +0000 (2007-11-24)
parents 9e88db95ddc7
children fb7b96a980f6
files extras/mini-os/include/semaphore.h
line diff
     1.1 --- a/extras/mini-os/include/semaphore.h	Sat Nov 24 13:26:39 2007 +0000
     1.2 +++ b/extras/mini-os/include/semaphore.h	Sat Nov 24 13:27:08 2007 +0000
     1.3 @@ -41,12 +41,14 @@ struct rw_semaphore {
     1.4  
     1.5  #define DECLARE_MUTEX_LOCKED(name) __DECLARE_SEMAPHORE_GENERIC(name,0)
     1.6  
     1.7 -static inline void init_MUTEX(struct semaphore *sem)
     1.8 +static inline void init_SEMAPHORE(struct semaphore *sem, int count)
     1.9  {
    1.10 -  sem->count = 1;
    1.11 +  sem->count = count;
    1.12    init_waitqueue_head(&sem->wait);
    1.13  }
    1.14  
    1.15 +#define init_MUTEX(sem) init_SEMAPHORE(sem, 1)
    1.16 +
    1.17  static void inline down(struct semaphore *sem)
    1.18  {
    1.19      unsigned long flags;