aboutsummaryrefslogtreecommitdiffstats
path: root/extras/mini-os/include/semaphore.h
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2007-11-24 13:27:08 +0000
committerKeir Fraser <keir.fraser@citrix.com>2007-11-24 13:27:08 +0000
commite8c2d5c38a73cc28d006371a226b62fed6c60ed9 (patch)
treee5573efbc6559c4e285cfdbed15d5601b5d22c72 /extras/mini-os/include/semaphore.h
parent59091f2d52524fa9157428f636023a274c2389e6 (diff)
downloadxen-e8c2d5c38a73cc28d006371a226b62fed6c60ed9.tar.gz
xen-e8c2d5c38a73cc28d006371a226b62fed6c60ed9.tar.bz2
xen-e8c2d5c38a73cc28d006371a226b62fed6c60ed9.zip
[Mini-OS] Add init_SEMAPHORE
Add init_SEMAPHORE() to dynamically initialize semaphores. Signed-off-by: Samuel Thibault <samuel.thibault@citrix.com>
Diffstat (limited to 'extras/mini-os/include/semaphore.h')
-rw-r--r--extras/mini-os/include/semaphore.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/extras/mini-os/include/semaphore.h b/extras/mini-os/include/semaphore.h
index 2c6394265e..261cd7e5da 100644
--- a/extras/mini-os/include/semaphore.h
+++ b/extras/mini-os/include/semaphore.h
@@ -41,12 +41,14 @@ struct rw_semaphore {
#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)
{
unsigned long flags;