Re: Update Cocoa object from callback
Re: Update Cocoa object from callback
- Subject: Re: Update Cocoa object from callback
- From: Chris Reed <email@hidden>
- Date: Wed, 28 May 2003 13:55:22 -0500
How frequently?
I don't know about the overhead of performSelectorOnMainThread:, but if
you're doing it _really_ frequently (hundreds of times a second? i
don't know..) you should maybe consider using a more direct method of
inter-thread communication, imho.
-chris
On Tuesday, May 27, 2003, at 21:19 US/Central, john wrote:
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.
_______________________________________________
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.