Re: NSURLDownload notifies on wrong thread?
Re: NSURLDownload notifies on wrong thread?
- Subject: Re: NSURLDownload notifies on wrong thread?
- From: Robert Nicholson <email@hidden>
- Date: Thu, 7 Jun 2007 03:29:22 +0700
In automator actions method calls are synchronous. I'm interested in
knowing what approaches people take when using NSURLDownload in an
automator action. Do you poll with a sub event loop where you're
detach thread? so if you have a number of batches to complete and
they must all finish before returning how do you 1. keep the delegate
methods firing and 2. ensure all batches are finished before returning.
for 1. i've used a subevent loop keeping track of when all batches
are finished in order to exit the loop.
for 2. i've used a NSConditionLock but i'm not convinced this is the
best way.
if you don't use 1. and just rely on 2. the delegate methods will not
fire.
secondly when i do this and want to communicate the results of each
batch back to the calling thread I use an NSMachPort but it seems for
some reason it blocks when the delegate method for the port is sent
or at least when accessing the components of the NSPortMessage.
Presumably if you get notified on the wrong thread you don't have the
contextual information you're seeking?
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden