summaryrefslogtreecommitdiffstats
path: root/include/asm-i386/semaphore.h
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1998-03-17 22:05:47 +0000
committerRalf Baechle <ralf@linux-mips.org>1998-03-17 22:05:47 +0000
commit27cfca1ec98e91261b1a5355d10a8996464b63af (patch)
tree8e895a53e372fa682b4c0a585b9377d67ed70d0e /include/asm-i386/semaphore.h
parent6a76fb7214c477ccf6582bd79c5b4ccc4f9c41b1 (diff)
Look Ma' what I found on my harddisk ...
o New faster syscalls for 2.1.x, too o Upgrade to 2.1.89. Don't try to run this. It's flaky as hell. But feel free to debug ...
Diffstat (limited to 'include/asm-i386/semaphore.h')
-rw-r--r--include/asm-i386/semaphore.h13
1 files changed, 7 insertions, 6 deletions
diff --git a/include/asm-i386/semaphore.h b/include/asm-i386/semaphore.h
index 3ba3f8af5..a68b23fc6 100644
--- a/include/asm-i386/semaphore.h
+++ b/include/asm-i386/semaphore.h
@@ -21,6 +21,7 @@
#include <asm/system.h>
#include <asm/atomic.h>
+#include <asm/spinlock.h>
struct semaphore {
atomic_t count;
@@ -38,6 +39,8 @@ asmlinkage void __up_wakeup(void /* special register calling convention */);
extern void __down(struct semaphore * sem);
extern void __up(struct semaphore * sem);
+extern spinlock_t semaphore_wake_lock;
+
#define sema_init(sem, val) atomic_set(&((sem)->count), (val))
/*
@@ -55,10 +58,9 @@ static inline void wake_one_more(struct semaphore * sem)
{
unsigned long flags;
- save_flags(flags);
- cli();
+ spin_lock_irqsave(&semaphore_wake_lock, flags);
sem->waking++;
- restore_flags(flags);
+ spin_unlock_irqrestore(&semaphore_wake_lock, flags);
}
static inline int waking_non_zero(struct semaphore *sem)
@@ -66,13 +68,12 @@ static inline int waking_non_zero(struct semaphore *sem)
unsigned long flags;
int ret = 0;
- save_flags(flags);
- cli();
+ spin_lock_irqsave(&semaphore_wake_lock, flags);
if (sem->waking > 0) {
sem->waking--;
ret = 1;
}
- restore_flags(flags);
+ spin_unlock_irqrestore(&semaphore_wake_lock, flags);
return ret;
}