Download C - Oracle Documentation
Transcript
A
while (busy) {
if (cv_wait_sig(&busy_cv, &busy_mu) == 0) {
/* returned because of signal */
/* free resources */
return (EINTR);
}
}
cv_timedwait( )
Another solution drivers used to avoid blocking on events that would not
occur was to set a timeout before the call to sleep. This timeout would occur far
enough in the future that the event should have happened, and if it did run it
would awaken the blocked process. The driver would then see if the timeout
function had run, and return some sort of error.
This can still be done in SunOS 5.x, but the same thing may be accomplished
with cv_timedwait(9F). An absolute time to wait for is passed to
cv_timedwait(9F), and which will return zero if the time is reached and the
event has not occurred. See Code Example 4-3 on page 89 for an example usage
of cv_timedwait(9F). Also see “Using cv_wait_sig(9F)” on page 90 for
information on cv_timedwait_sig(9F).
Other Locks
Semaphores and readers/writers locks are also available. See semaphore(9F)
and rwlock(9F).
Lock Granularity
Generally, start with one, and add more depending on the abilities of the
device. See “Choosing a Locking Scheme” on page 91 and Appendix F,
“Advanced Topics,” for more information.
Interrupts
In SunOS 4.x, two distinct methods were used for handling interrupts.
•
364
Polled, or autovectored, interrupts were handled by calling the xxpoll( )
routine of the device driver. This routine was responsible for checking all
drivers’ active units.
Writing Device Drivers—May 1996
Related documents
C - Oracle Documentation
Writing Device Drivers
UM1112 User manual - FTP Directory Listing
AN3518 - Freescale Semiconductor
Note su Solaris 10 - Oracle Documentation
Deni 5226 Specifications
Red Hat ENTERPRISE LINUX 3 - DEVELOPER TOOLS GUIDE Specifications
Harbor Freight Tools 93431 User's Manual
Vista 120 (Manuale Utente) - Elektra2000 Installazioni
RCS - Digalog Systems, Inc.
Manuale 5827BD
PDF