Re: down_interruptible and timers

MOLNAR Ingo (mingo@chiara.csoma.elte.hu)
Mon, 25 Jan 1999 16:24:52 +0100 (CET)


> #define sema_init(sem, val) \
> (sem)->owner = (sem)->owner_depth = (sem)->waking = 0; \
> (sem)->wait = NULL; \
> (sem)->count = (val); \
> wmb();

(this does not even compile, try something like the attached patch
instead)

--- linux/include/asm-i386/semaphore.h.orig Mon Jan 25 16:02:28 1999
+++ linux/include/asm-i386/semaphore.h Mon Jan 25 16:25:06 1999
@@ -77,7 +77,15 @@

extern spinlock_t semaphore_wake_lock;

-#define sema_init(sem, val) atomic_set(&((sem)->count), (val))
+#define sema_init(sem, val) \
+ do { \
+ (sem)->owner = 0; \
+ (sem)->owner_depth = 0; \
+ (sem)->waking = 0; \
+ (sem)->wait = NULL; \
+ (sem)->count.counter = (val); \
+ wmb(); \
+ } while (0)

/*
* These two _must_ execute atomically wrt each other.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/