diff options
author | John M. Calandrino <jmc@jupiter-cs.cs.unc.edu> | 2007-05-10 00:20:00 -0400 |
---|---|---|
committer | John M. Calandrino <jmc@jupiter-cs.cs.unc.edu> | 2007-05-10 00:20:00 -0400 |
commit | 5621897b6614128e91621a8bd1fb1c03f8b5112b (patch) | |
tree | fd6b8d5d71ef8df17e8ba772c0fa0e553d7d0cb7 /arch | |
parent | a799fe60722267fcdd52c1fbf10e8f704fb53a9a (diff) |
First attempt at FIFO semaphores and PI sems. This may not work...
Before FIFO, everything seemed to be (finally) working ok.
Diffstat (limited to 'arch')
-rw-r--r-- | arch/i386/kernel/pi_sem_syscalls.c | 4 | ||||
-rw-r--r-- | arch/i386/kernel/sem_syscalls.c | 6 |
2 files changed, 8 insertions, 2 deletions
diff --git a/arch/i386/kernel/pi_sem_syscalls.c b/arch/i386/kernel/pi_sem_syscalls.c index 1034c1ccbe..0d1753495e 100644 --- a/arch/i386/kernel/pi_sem_syscalls.c +++ b/arch/i386/kernel/pi_sem_syscalls.c | |||
@@ -68,7 +68,9 @@ void __sys_pi_down(struct pi_semaphore * sem) | |||
68 | // :"+m" (sem->count) | 68 | // :"+m" (sem->count) |
69 | // : | 69 | // : |
70 | // :"memory","ax"); | 70 | // :"memory","ax"); |
71 | if (atomic_dec_return(&sem->count) < 0) | 71 | // |
72 | /* Checking for active waitqueue gives others a chance... */ | ||
73 | if (atomic_dec_return(&sem->count) < 0 || waitqueue_active(&sem->wait)) | ||
72 | __pi_down(sem); | 74 | __pi_down(sem); |
73 | } | 75 | } |
74 | 76 | ||
diff --git a/arch/i386/kernel/sem_syscalls.c b/arch/i386/kernel/sem_syscalls.c index 274687d21c..4ca92c9be5 100644 --- a/arch/i386/kernel/sem_syscalls.c +++ b/arch/i386/kernel/sem_syscalls.c | |||
@@ -45,7 +45,11 @@ asmlinkage long sys_down(sema_id sem_id) | |||
45 | if (sem_id < 0 || sem_id >= MAX_SEMAPHORES) | 45 | if (sem_id < 0 || sem_id >= MAX_SEMAPHORES) |
46 | return -EINVAL; | 46 | return -EINVAL; |
47 | 47 | ||
48 | down(&sems[sem_id]); | 48 | /* This allows for FIFO sems and gives others a chance... */ |
49 | if (waitqueue_active(&sems[sem_id].wait)) | ||
50 | __down(&sems[sem_id]); | ||
51 | else | ||
52 | down(&sems[sem_id]); | ||
49 | return 0; | 53 | return 0; |
50 | } | 54 | } |
51 | 55 | ||