patch-2.1.34 linux/include/asm-ppc/semaphore.h
Next file: linux/include/asm-sparc/atomic.h
Previous file: linux/include/asm-ppc/errno.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-ppc/semaphore.h
-  Orig date: 
Wed Dec 18 00:54:10 1996
diff -u --recursive --new-file v2.1.33/linux/include/asm-ppc/semaphore.h linux/include/asm-ppc/semaphore.h
@@ -18,6 +18,23 @@
 extern void atomic_add(int c, int *v);
 extern void atomic_sub(int c, int *v);
 
+#define sema_init(sem, val)	atomic_set(&((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;
+}
+
 extern inline void down(struct semaphore * sem)
 {
   for (;;)
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov