The HyperNews Linux KHG Discussion Pages

Idea: wrong functions

Forum: The Linux Kernel Hackers' Guide
Re: Question interruptible_sleep_on() too slow! (Bill Blackwell)
Keywords: device driver interrupts interruptible_sleep_on()
Date: Fri, 31 Oct 1997 13:39:12 GMT
From: Michael K. Johnson <[email protected]>

Getting around this common race condition without disabling interrupts is one of Linux's features.

You need to add the function to the wait queue before you write to the board and cause the interrupt to occur. Look at kernel/sched.c at the definition of interruptible_sleep_on(): You want to do something like this:

  current->state = TASK_INTERRUPTIBLE;
  add_wait_queue(this_entry, &wait);
  remove_wait_queue(this_entry, &wait);
Linux's serial.c uses this trick.