patch-2.1.22 linux/include/asm-alpha/semaphore.h

Next file: linux/include/asm-i386/semaphore.h
Previous file: linux/fs/smbfs/inode.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.21/linux/include/asm-alpha/semaphore.h linux/include/asm-alpha/semaphore.h
@@ -11,7 +11,7 @@
 
 struct semaphore {
 	atomic_t count;
-	atomic_t waiting;
+	atomic_t waking;
 	struct wait_queue * wait;
 };
 
@@ -19,6 +19,7 @@
 #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);
 
 /*
@@ -27,11 +28,16 @@
  */
 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