Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site uwvax.ARPA Path: utzoo!linus!decvax!tektronix!hplabs!hao!seismo!uwvax!dave From: dave@uwvax.ARPA Newsgroups: net.unix-wizards Subject: Re: Device driver subtleties Message-ID: <356@uwvax.ARPA> Date: Wed, 25-Jul-84 11:06:34 EDT Article-I.D.: uwvax.356 Posted: Wed Jul 25 11:06:34 1984 Date-Received: Sat, 28-Jul-84 06:31:12 EDT References: <336@sri-arpa.UUCP> Organization: U of Wisconsin CS Dept Lines: 31 > From: Don Speck > > When writing a device driver, what does it mean to call sleep() while > at ipl 0x14? I'm using it like this: > rlpwrite(args) { > ... > (void) spl4(); /* Lock out interrupts between test and sleep */ > while (! flag_set_by_interrupt_routine) { > sleep((caddr_t)lp->lp_buf, PZERO+8); > } > (void) spl0(); If you raise your priority like this, it will lock out *ALL* interrupts for all priorities <= spl4(). How is your 'flag_set_by_interrupt_routine' going to get set when the interrupt will never get received? Methinks you have process priority and device priority confused. Also, your code can do unexpected things. A more correct way of handling the spl's is: spx = spl4(); /* save old priority and change to spl 4 */ < critical section > (void) splx(spx); /* restore priority to normal */ Now, back to your question. The sleep() will sleep at priority PZERO (normal) plus 8. This means it's interruptable by signals (which won't be sent because you're at high priority, so noone else is going to run, except maybe the clock). -- Dave Cohrs @ wisconsin ...!{allegra,heurikon,ihnp4,seismo,ucbvax,uwm-evax}!uwvax!dave dave@wisc-rsch.arpa