Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

tsleep question

From: Alexandre Ratchov <aratchov(at)magphy.ujf-grenoble.fr>
Date: Mon May 12 2003 - 09:11:23 EDT


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
Received on Mon May 12 09:18:30 2003

This archive was generated by hypermail 2.1.8 : Wed Aug 23 2006 - 13:48:39 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library