[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
tsleep question
Hello,
i'm working on a midi device driver and i have the following question
about the 'read' system call:
s = splaudio();
while (!data) {
tsleep(&bla, PWAIT|PCATCH, "rd", 0);
}
splx(s);
the caller needs to sleep until data becomes available, when data arrives,
the interrupt handler calls wakeup(). If i do not disable interrupts, an
interrupt can occur between the "while" and the "tsleep", which will "hang"
the process. When tsleep switches to another process context, does it
restore the system priority level? Is this the right way to wait for data?
thanks, and sorry for my poor english.
--
Alex