Re: Thread safety with background fetching
Re: Thread safety with background fetching
- Subject: Re: Thread safety with background fetching
- From: Phil <email@hidden>
- Date: Fri, 1 Aug 2008 11:21:48 +1200
On Fri, Aug 1, 2008 at 4:59 AM, Ben <email@hidden> wrote:
> and then -[XMLFetcherParser doYourThing] repeatedly sends newly created
> objects to receiveItem: using the performSelectorOnMainThread method. Once
> the spawned thread has done this, it never uses the sent object again.
>
>
> My question is how should I protect this code from thread related problems?
> Do I just place @synchronized(){} blocks around the code in receiveItem: and
> it's counterpart in the spawned thread? Or is that just plain wrong? Or
> (likely) am I barking up totally the wrong tree?
>
Since it doesn't look like you're sharing any ivars or objects between
the threads, I don't think you'll need any @synchronized blocks or
locking. The only thing I can see you'll want to watch out for is the
memory management of the objects that you pass to -receiveItem:.
Phil
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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