lkml.org 
[lkml]   [1999]   [Jan]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: down_interruptible and timers

> #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/

\
 
 \ /
  Last update: 2005-03-22 13:49    [W:1.349 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site