DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Multithreading device drivers

Modifying the intr routine

Lock the critical code section before adjusting a driver's queue or before modifying b_active. An interrupt routine in a disk driver that has not been converted for multiprocessor access typically contains:

   dp = &xxtab;
   dp->b_active = 0;
   dp->b_actf = bp->av_forw;
   xxstart(xxstart_arg);
To protect critical code sections, change the above code to the following:
   dp = &xxtab;
   s = lockb(&lock_xxtab);
   dp->b_active = 0;
   dp->b_actf = bp->av_forw;
   xxstart(xxstart_arg);
   splx(s);
The xxstart( ) routine releases lock_xxtab (calls unlockb(D3oddi) and leaves only the spl level to be restored. Note that all callers of xxstart need to acquire lock_xxtab (via lockb) before calling xxstart.
© 2005 The SCO Group, Inc. All rights reserved.