Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Devices /
Chapter 1 - Device Manager / Device Manager Reference
Device Manager Functions / Opening and Closing Device Drivers


CloseDriver

You can use the CloseDriver function to close an open device driver.

pascal OSErr CloseDriver(short refNum); 
refNum
The driver reference number returned by the driver-opening function.
DESCRIPTION
The CloseDriver function closes the device driver indicated by the refNum parameter. The Device Manager waits until the driver is inactive before calling the driver's close routine. When the driver indicates it has processed the close request, the Device Manager unlocks the driver resource if the dRAMBased flag is set, and unlocks the device control entry if the dNeedLock flag is not set. The Device Manager does not dispose of the device control entry or remove it from the unit table.

This function is a high-level version of the low-level PBClose function. Use the PBClose function when you want to specify a completion routine.

WARNING
You should not close drivers that other applications may be using, such as a disk driver, the AppleTalk drivers, and so on.
SPECIAL CONSIDERATIONS
The Device Manager does not queue close requests.

WARNING
Do not call the CloseDriver function at interrupt time because if the driver was processing a request when the interrupt occurred the Device Manager may loop indefinitely, waiting for the driver to complete the request.
RESULT CODES
noErr0No error
badUnitErr-21Driver reference number does not match unit table
unitEmptyErr-22Driver reference number specifies a nil handle in unit table
closErr-24Driver unable to complete close request
dRemovErr-25Attempt to remove an open driver
SEE ALSO
For information about the low-level function for closing device drivers, see the next section, which describes the PBClose function.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
3 JUL 1996