patch-2.1.23 linux/include/asm-sparc/semaphore.h
Next file: linux/include/asm-sparc/sigcontext.h
Previous file: linux/include/asm-sparc/ptrace.h
Back to the patch index
Back to the overall index
- Lines: 51
- Date:
Sun Jan 26 12:07:47 1997
- Orig file:
v2.1.22/linux/include/asm-sparc/semaphore.h
- Orig date:
Tue Nov 12 15:56:13 1996
diff -u --recursive --new-file v2.1.22/linux/include/asm-sparc/semaphore.h linux/include/asm-sparc/semaphore.h
@@ -1,16 +1,13 @@
#ifndef _SPARC_SEMAPHORE_H
#define _SPARC_SEMAPHORE_H
-/* Dinky, good for nothing, just barely irq safe, Sparc semaphores.
- *
- * I'll write better ones later.
- */
+/* Dinky, good for nothing, just barely irq safe, Sparc semaphores. */
#include <asm/atomic.h>
struct semaphore {
atomic_t count;
- atomic_t waiting;
+ atomic_t waking;
struct wait_queue * wait;
};
@@ -18,19 +15,24 @@
#define MUTEX_LOCKED ((struct semaphore) { 0, 0, NULL })
extern void __down(struct semaphore * sem);
+extern int __down_interruptible(struct semaphore * sem);
extern void __up(struct semaphore * sem);
-/*
- * This isn't quite as clever as the x86 side, but the gp register
- * makes things a bit more complicated on the alpha..
+/* This isn't quite as clever as the x86 side, I'll be fixing this
+ * soon enough.
*/
extern inline void down(struct semaphore * sem)
{
- for (;;) {
- if (atomic_dec_return(&sem->count) >= 0)
- break;
+ if (atomic_dec_return(&sem->count) < 0)
__down(sem);
- }
+}
+
+extern inline int down_interruptible(struct semaphore * sem)
+{
+ int ret = 0;
+ if(atomic_dec_return(&sem->count) < 0)
+ ret = __down_interruptible(sem);
+ return ret;
}
extern inline void up(struct semaphore * sem)
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov