* Wait queue problem
@ 2002-04-17 10:03 Andre.Messerschmidt
2002-04-19 1:16 ` Ralf Baechle
2007-07-20 12:21 ` Misbah khan
0 siblings, 2 replies; 4+ messages in thread
From: Andre.Messerschmidt @ 2002-04-17 10:03 UTC (permalink / raw)
To: linux-mips
Hi,
Does anybody else have problems using wait queues in a 2.4.5 MIPS kernel?
When I try to wake up a process from an interrupt it won't start to execute.
It always waits for the timeout before resuming work.
In principal my code look like this:
wait_queue_head_t wq;
foo() {
init_waitqueue_head(&wq);
interruptible_sleep_on_timeout(&wq,10*HZ);
}
foo_int() {
wake_up_interuptible(&wq);
}
Am I missing something?
best regards
--
Andre Messerschmidt
Application Engineer
Infineon Technologies AG
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Wait queue problem
2002-04-17 10:03 Wait queue problem Andre.Messerschmidt
@ 2002-04-19 1:16 ` Ralf Baechle
2002-04-19 2:01 ` Richard Hodges
2007-07-20 12:21 ` Misbah khan
1 sibling, 1 reply; 4+ messages in thread
From: Ralf Baechle @ 2002-04-19 1:16 UTC (permalink / raw)
To: Andre.Messerschmidt; +Cc: linux-mips
On Wed, Apr 17, 2002 at 12:03:19PM +0200, Andre.Messerschmidt@infineon.com wrote:
> Does anybody else have problems using wait queues in a 2.4.5 MIPS kernel?
> When I try to wake up a process from an interrupt it won't start to execute.
> It always waits for the timeout before resuming work.
> In principal my code look like this:
>
> wait_queue_head_t wq;
>
> foo() {
> init_waitqueue_head(&wq);
> interruptible_sleep_on_timeout(&wq,10*HZ);
> }
>
> foo_int() {
> wake_up_interuptible(&wq);
> }
>
> Am I missing something?
A bad race condition in that code. If foo_int is called before your process
had a chance to get to sleep it'll never be woken before the timeout.
Ralf
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Wait queue problem
2002-04-19 1:16 ` Ralf Baechle
@ 2002-04-19 2:01 ` Richard Hodges
0 siblings, 0 replies; 4+ messages in thread
From: Richard Hodges @ 2002-04-19 2:01 UTC (permalink / raw)
To: Ralf Baechle; +Cc: Andre.Messerschmidt, linux-mips
> On Wed, Apr 17, 2002 at 12:03:19PM +0200, Andre.Messerschmidt@infineon.com wrote:
>
> > Does anybody else have problems using wait queues in a 2.4.5 MIPS kernel?
> > When I try to wake up a process from an interrupt it won't start to execute.
> > It always waits for the timeout before resuming work.
> > In principal my code look like this:
> >
> > wait_queue_head_t wq;
> >
> > foo() {
> > init_waitqueue_head(&wq);
> > interruptible_sleep_on_timeout(&wq,10*HZ);
> > }
> >
> > foo_int() {
> > wake_up_interuptible(&wq);
> > }
> >
> > Am I missing something?
On Thu, 18 Apr 2002, Ralf Baechle wrote:
> A bad race condition in that code. If foo_int is called before your process
> had a chance to get to sleep it'll never be woken before the timeout.
That reminds me :-)
I have looked around for a version of wait_event_interruptible() that
has a timeout (starting my search in sched.h of course). Before I get
around to writing my own, does anyone have one already?
Thanks,
-Richard
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Wait queue problem
2002-04-17 10:03 Wait queue problem Andre.Messerschmidt
2002-04-19 1:16 ` Ralf Baechle
@ 2007-07-20 12:21 ` Misbah khan
1 sibling, 0 replies; 4+ messages in thread
From: Misbah khan @ 2007-07-20 12:21 UTC (permalink / raw)
To: linux-mips
I guess that you are missing one more condition the flag bit which you need
to set and reset accordingly in the function and in the interrupt handler
interruptible_sleep_on_timeout(&wq,flag!=0,10*HZ);
Try out this for any query please let me know
regard
misbah
Andre.Messerschmidt wrote:
>
> Hi,
>
> Does anybody else have problems using wait queues in a 2.4.5 MIPS kernel?
> When I try to wake up a process from an interrupt it won't start to
> execute.
> It always waits for the timeout before resuming work.
> In principal my code look like this:
>
> wait_queue_head_t wq;
>
> foo() {
> init_waitqueue_head(&wq);
> interruptible_sleep_on_timeout(&wq,10*HZ);
> }
>
> foo_int() {
> wake_up_interuptible(&wq);
> }
>
> Am I missing something?
>
> best regards
> --
> Andre Messerschmidt
>
> Application Engineer
> Infineon Technologies AG
>
>
>
>
--
View this message in context: http://www.nabble.com/Wait-queue-problem-tf2852319.html#a11707153
Sent from the linux-mips main mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-07-20 12:21 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-04-17 10:03 Wait queue problem Andre.Messerschmidt
2002-04-19 1:16 ` Ralf Baechle
2002-04-19 2:01 ` Richard Hodges
2007-07-20 12:21 ` Misbah khan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox