On Thu, 2003-09-11 at 23:50, kkonaka@mac.com wrote: > howdy, > > suppose I have a (character) driver code, > > does the following piece of code break under preemptive > kernel option enabled? -- is there any pointer regarding > precisely when kernel preemption can take place? > > TIA > kenji > > -- > int busy = 0; > wait_queue_head_t q; > some_resource res; /* data structure shared between processes */ > > ssize_t my_write(struct file * file, const char * buf, > size_t count, loff_t *ppos) > { > while (busy) { /* grab exclusive access */ > interruptible_sleep_on(&q); > } > > <do something assuming exclusive access to resources> > > busy = 0; /* release exclusive access */ > wake_up_interruptible(&q); > return retval; this code already breaks even without a non-preemptible kernel..... your use of *_sleep_on() is defective.
Attachment:
signature.asc
Description: This is a digitally signed message part