Re: Update Cocoa object from callback
Re: Update Cocoa object from callback
- Subject: Re: Update Cocoa object from callback
- From: john <email@hidden>
- Date: Tue, 27 May 2003 22:19:01 -0400
Would calling performSelectorOnMainThread: very frequently cause any
strange overhead that would make it undesirable?
Thanks.
-- John
Calling most of Cocoa's API requires doing so within a block guarded
by an autorelease pool. The threads that Cocoa owns itself will
arrange for this to be true. However, you are on your own when you are
executing code on threads not owned by Cocoa, like the CoreAudio
threads.
When I find myself in a situation where I need to call back into
Cocoa, I do one of two things. Either I explicitly create an
autorelease pool around the block of code in question or, more
usually, I make use of
-performSelectorOnMainThread:withObject:waitUntilDone: to be sure the
work I'm doing gets done on a known safe-for-Cocoa thread.
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.