Re: mount() from Cocoa App
Re: mount() from Cocoa App
- Subject: Re: mount() from Cocoa App
- From: Jim Luther <email@hidden>
- Date: Mon, 17 Oct 2005 15:02:52 -0700
On Oct 17, 2005, at 2:18 PM, Quinn wrote:
My general advice for dealing with timeouts is to use an infinite
timeout and provide the user with status and a way to cancel. That
way, if the user has kicked out their network cable (or is on the
wrong AirPort network, or whatever), they get a chance to rectify
that problem without you artificially timing out. You should only
use a specific timeout if it's not appropriate to provide a cancel
button (for example, you're a server).
Implementing this philosophy for server mounting is easy because
Apple provides you with a cancel call (FSCancelVolumeOperation).
I missed the obvious answer... That's what I get for answering
questions after being away from DTS for 10 years :-)
However, I looked at what FSCancelVolumeOperation does in this case
(since I recently worked on the framework below it) and there's an
edge case that's worth mentioning...
FSCancelVolumeOperation indirectly causes a kill(2) on the mount
process. If the mount process completes just as your
FSCancelVolumeOperation call comes in, the results cannot be determined:
* If you get an error back from FSCancelVolumeOperation (probably an
ioErr) then the mount process has probably already completed and the
volume should be mounted.
* If you get no errors back from FSCancelVolumeOperation, then you
killed the mount process and the volume MAY OR MAY NOT be mounted --
it depends on if the mount command has called mount(2) to mount the
volume or not. If mount(2) has completed successfully, then the
volume should be mounted. If mount(2) has not completely
successfully, then the volume should not be mounted.
- Jim
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden