All of lore.kernel.org
 help / color / mirror / Atom feed
* waiting on a condition
@ 2004-10-13 15:23 Martijn Sipkema
  2004-10-13 14:55 ` Neil Horman
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Martijn Sipkema @ 2004-10-13 15:23 UTC (permalink / raw)
  To: linux-kernel

L.S.

I'd like to do something similar as can be done using a POSIX condition
variable in the kernel, i.e. wait for some condition to become true. The
pthread_cond_wait() function allows atomically unlocking a mutex and
waiting on a condition. I think I should do something like:
(the condition is updated from an interrupt handler)

disable interrupts
acquire spinlock
if condition not satisfied
    add task to wait queue
    set task to sleep
release spinlock
restore interrupts
schedule

Now, this will only work with preemption disabled within the critical
section. How would something like this be done whith preemption
enabled?


--ms





^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2004-10-15 14:16 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-13 15:23 waiting on a condition Martijn Sipkema
2004-10-13 14:55 ` Neil Horman
2004-10-13 15:05   ` Duncan Sands
2004-10-13 15:30 ` Peter W. Morreale
2004-10-13 20:58   ` Martijn Sipkema
2004-10-13 20:58   ` Martijn Sipkema
2004-10-14 15:37     ` Davide Rossetti
2004-10-14 15:49       ` Richard B. Johnson
2004-10-15 13:13     ` Alan Cox
2004-10-13 15:34 ` Christophe Saout

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.