[physfs] Mounting files & CD checking

Ryan C. Gordon icculus at icculus.org
Wed Jul 8 03:40:45 EDT 2009


> That's exactly what I'm trying to avoid, the wait if you've just 
> inserted the disc.

I just tested this on Windows XP and it does indeed block for a few 
seconds when you close the CD tray, even if you haven't inserted a disc. 
When Windows isn't trying to do the initial spin-up of the disc--whether 
a disc is in the drive or not--there's no blocking.

For Windows, you'll have to spin a thread for the check to avoid this. 
There doesn't appear to be a way I could avoid this internally unless I 
spin a thread in PHYSFS_init() and just poll the CD drives every few 
seconds, but that seems unreasonable for a function most apps never 
call, to avoid a behaviour on one platform that most users will accept 
anyhow.

But, again, you should definitely be able to spin a thread, call 
PHYSFS_getCdRomDrives() in there every few seconds, and set a global 
variable or something when a disc is inserted. This will allow your app 
to avoid the lag when the user inserts the disc.

--ryan.




More information about the physfs mailing list