Re: wake_up from interrupt handler

From: Arjan van de Ven (arjanv@redhat.com)
Date: Mon Oct 07 2002 - 08:04:17 EST


On Mon, 2002-10-07 at 14:41, Amol Lad wrote:
> Hi,
> I have a kernel thread which did add_to_wait_queue()
> to wait for an event.
> The event for which above thread is waiting occurs in
> an interrupt handler that calls wake_up() to wake the
> above thread.
> Now I am faced with a 'lost wakeup' problem, in which
> the
> kernel thread checks whether event occured, he finds
> it to be 'not-occured' but before calling
> add_to_wait_queue(), interrupt handler detects that
> the event has occured and calls wake_up().
> My thread sleeps forever.

set_current_state(TASK_INTERRUPTIBLE);
add_to_wait_queue(...);
if (even_occured) { ...}
  else
     schedule();
 
remove_from_wait_queue(..);
set_current_state(TASK_RUNNABLE);

>



-
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/



This archive was generated by hypermail 2b29 : Mon Oct 07 2002 - 22:00:58 EST