[lkml]   [2004]   [Oct]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: waiting on a condition
Have you looked at the wait_event() family yet?       Adapting that 
methodolgy might
suit your needs.

I don't know much about preemption yet, however I suspect it would be a
bug to allow
preemption while the spinlock was held. In other words, you might need
to do something like

disable preemption
rc = condition
enable preemption
if (rc)

In other words, perform the test on the condition outside of the
critical region protected by the spin lock.


Martijn Sipkema wrote:

>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
>Now, this will only work with preemption disabled within the critical
>section. How would something like this be done whith preemption
>To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>the body of a message to
>More majordomo info at
>Please read the FAQ at

Peter W. Morreale email:
Director of Engineering Niwot, Colorado, USA
Radiant Data Corporation voice: (303) 652-0870 x108
This transmission may contain information that is privileged, confidential
and/or exempt from disclosure under applicable law. If you are not the
intended recipient, you are hereby notified that any disclosure, copying,
distribution, or use of the information contained herein (including any
reliance thereon) is STRICTLY PROHIBITED. If you received this transmission
in error, please immediately contact the sender and destroy the material in
its entirety, whether in electronic or hard copy format. Thank you.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 14:07    [W:0.087 / U:39.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site