Re: FSMountServerVolumeAsync() in multiple threads?
Re: FSMountServerVolumeAsync() in multiple threads?
- Subject: Re: FSMountServerVolumeAsync() in multiple threads?
- From: Kevin Elliott <email@hidden>
- Date: Tue, 11 Aug 2009 20:51:36 -0700
I'd have to look into your code to know for certain what's going
wrong, but your raising a few red flags.
In particular, your spawning a new thread and then (from the sound of
it) doing one FSMountServerVolumeAsync per thread. That sounds very
odd. If your going to go to the trouble of creating a separate
thread, why not just call FSMountServerVolumeSync? Are you creating a
runLoop in your thread for your callbacks to fire on? Is the -50
error coming from FSMountServerVolumeAsync directly, or when your
callback fires? You said this was working in one thread- why are you
moving to multiple threads?
-Kevin
PS. Officially I'm on vacation, so I'll apologize in advance if you
don't get timely responses. Sometimes a man just needs a little RR in
the great outdoors.
On Aug 11, 2009, at 5:28 PM, Matt DeFoor wrote:
I have an application where I'm trying to mount multiple volumes in
their own thread using FSMountServerVolumeAsync(). The application is
Cocoa-based. So, I use:
[NSThread detachNewThreadSelector:@selector(mountResource:)
toTarget:self withObject:aResource]
to spawn each thread. The call to FSMountServerVolumeAsync() looks
like this:
Result = FSMountServerVolumeAsync((CFURLRef)urlOfVolumeToMount, NULL,
(CFStringRef)[aResource username], (CFStringRef)[aResource password],
volumeOp, aResource, 0, mountUPP, CFRunLoopGetCurrent(),
CFSTR("MyMountMode"));
As you can tell, I'm using a callback. It handles certain aspects of
what is returned. When, I have only one thread, things work fine; the
callback is called and the volume is mounted. When I have more than
one volume to mount (ergo, more than one thread is calling
FSMountServerVolumeAsync()) varying results are produced. For example,
the return code from FSMountServerVolumeAsync() might be -50. Or there
might be an exception (EXC_BAD_ACCESS) in one of the functions that
FSMountServerVolumeAsync() calls (e.g. TAFPSession::AFPLogout).
Has anyone had success using FSMountServerVolumeAsync() in this
manner?
Is there a better approach to FSMountServerVolumeAsync()'s usage?
Thanks,
Matt
P.S. Jim Luther suggest that I post here instead of the
macnetworkprog list.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Filesystem-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Filesystem-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden