On Tue, Jun 08, 2004 at 15:53:36 +0530, aksingh@hss.hns.com wrote: > > > > > Hi, > > This is the way I intend to block the read call on my char device, if > there is no data to be read. > > void block() { > DECLARE_WAITQUEUE(w, current); > __add_wait_queue(&some_wait_queue, &w); > current->state=TASK_INTERRUPTIBLE; > if (!isready()) > schedule(); > current->state=TASK_RUNNING; > remove_wait_queue(&some_wait_queue, &w); > } You should do: void block() { wait_event(some_wait_queue, isready()); } That macro is simply known to get it right and makes your code a LOT more readable. It also has _interruptible variant, if you need to take care of signals. ------------------------------------------------------------------------------- Jan 'Bulb' Hudec <bulb@ucw.cz>
Attachment:
signature.asc
Description: Digital signature