linux-mips
[Top] [All Lists]

Re: Wait queue problem

To: Ralf Baechle <ralf@oss.sgi.com>
Subject: Re: Wait queue problem
From: Richard Hodges <rh@matriplex.com>
Date: Thu, 18 Apr 2002 19:01:33 -0700 (PDT)
Cc: Andre.Messerschmidt@infineon.com, linux-mips@oss.sgi.com
In-reply-to: <20020418181652.A25562@dea.linux-mips.net>
Sender: owner-linux-mips@oss.sgi.com
> 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


<Prev in Thread] Current Thread [Next in Thread>