lkml.org 
[lkml]   [2001]   [Sep]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Synchronization Techniques in 2.2 Kernel
Wayne Cuddy wrote:

>If I understand wait_queues correctly the process has to be sleeping before a
>wake_up call will have any effect (I.E. they are not queued). Can this be
>worked around with semaphores or some other method? I am open to ideas here.
>
>Any and all help is appreciated.
>
>Wayne
>
I apologize in advance if this is not quite right, having only done
"hello world" kernel modules thus far (plus a good deal of kernel source
browsing). I think you need to "unfold" the interruptible_sleep_on call
and do it yourself by adding current to the wait queue before checking
any cards, setting current->state = TASK_INTERRUPTIBLE, then checking
all cards and if none has data, calling schedule. When you get back
from schedule (i.e. your ISR has received data and done a wake_up) or
any card has data, remove yourself from the wait queue and set your
state to runnable. This hopefully gives you the "atomic check condition
and sleep if not satisfied" behavior.

Regards,
Brian Strand



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

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