patch-2.1.34 linux/include/asm-m68k/semaphore.h
Next file: linux/include/asm-mips/processor.h
Previous file: linux/include/asm-m68k/ide.h
Back to the patch index
Back to the overall index
-  Lines: 24
-  Date:
Mon Apr 14 09:31:09 1997
-  Orig file: 
v2.1.33/linux/include/asm-m68k/semaphore.h
-  Orig date: 
Fri Nov 22 05:56:36 1996
diff -u --recursive --new-file v2.1.33/linux/include/asm-m68k/semaphore.h linux/include/asm-m68k/semaphore.h
@@ -26,6 +26,23 @@
 extern void __down(struct semaphore * sem);
 extern void __up(struct semaphore * sem);
 
+#define sema_init(sem, val)	((sem)->count = val)
+
+static inline int waking_non_zero(struct semaphore *sem)
+{
+	unsigned long flags;
+	int ret = 0;
+
+	save_flags(flags);
+	cli();
+	if (atomic_read(&sem->waking) > 0) {
+		atomic_dec(&sem->waking);
+		ret = 1;
+	}
+	restore_flags(flags);
+	return ret;
+}
+
 /*
  * This is ugly, but we want the default case to fall through.
  * "down_failed" is a special asm handler that calls the C
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov