• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Update Cocoa object from callback
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: Update Cocoa object from callback
      • From: john <email@hidden>
  • Prev by Date: Re: What corresponds to kAudioDevicePropertyDeviceIsRunningSomewhere in an audio driver?
  • Next by Date: Re: Can anyone comment on Crashes in AUParameterSet?
  • Previous by thread: Re: Update Cocoa object from callback
  • Next by thread: Re: Update Cocoa object from callback
  • Index(es):
    • Date
    • Thread