I'm using the DiskArbitration framework for unmounting and ejecting removable CD media. I have run into a peculiar issue where sometimes CDs unmount successfully, but fail to eject. My code looks like:
Unmount the disc in preparation for ejection:
DADiskUnmount(disk, kDADiskUnmountOptionWhole, unmountCallback, context);
If the unmount was successful, request the eject in unmountCallback:
if(NULL != dissenter) { DAReturn status = DADissenterGetStatus(dissenter); // Error handling omitted }
DADiskEject(disk, kDADiskEjectOptionDefault, ejectCallback, context);
And finally, the code that produces the error message:
if(NULL != dissenter) { DAReturn status = DADissenterGetStatus(dissenter); // Error occurs here }
The strange thing is, maybe 50% or more of the time the disc will unmount but fail to eject with an error code 16 (Resource Busy). I assume since the disc successfully unmounted that no resources should be in use. I don't see any other DA* APIs that will do what I want.
Have I missed something in my usage of the framework?
Stephen |