• 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: scheduling a block from a render callback
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: scheduling a block from a render callback


  • Subject: Re: scheduling a block from a render callback
  • From: Ross Bencina <email@hidden>
  • Date: Wed, 15 Jan 2014 14:26:37 +1100

On 15/01/2014 1:42 PM, Kyle Sluder wrote:
That assumes that constructing a block is real-time safe. It
probably isn't.
>
It makes no such assumption. AddNotificationHandler would be called
from the non-realtime-thread.  PostNotification would be called from
the realtime thread; this function would perform a modicum of
realtime-thread-safe work to cause a non-realtime thread to submit
the registered block to its corresponding dispatch queue.

Fair enough.

It kind of defeats the purpose of using a closure if you can't use it to pass data from the (notifying) context though.

If it were me I'd prefer something like an asynchronous RPC -- which is effectively what you get if you use dispatch_async and block creation.

In AudioMulch I have a mechanism like this where function pointers and parameters get pushed onto a lock free queue. I think you can probably build a mechanism like this with blocks too. dispatch_async moves the block data to the heap (hence malloc gets involved), but a custom lock-free queue could move the block into a ringbuffer.

Did I post this already:

http://www.cocoawithlove.com/2009/10/how-blocks-are-implemented-and.html

Of course it's better to ween yourself off Objective-C for real-time code. Objective-C is just another one of Apple's vendor-lock-in mechanisms.

Ross.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: scheduling a block from a render callback
      • From: Kyle Sluder <email@hidden>
    • Re: scheduling a block from a render callback
      • From: Paul Davis <email@hidden>
References: 
 >scheduling a block from a render callback (From: Lucas Ives <email@hidden>)
 >RE: scheduling a block from a render callback (From: Tim Dorcey <email@hidden>)
 >Re: scheduling a block from a render callback (From: Paul Davis <email@hidden>)
 >RE: scheduling a block from a render callback (From: Tim Dorcey <email@hidden>)
 >Re: scheduling a block from a render callback (From: Doug Wyatt <email@hidden>)
 >Re: scheduling a block from a render callback (From: Paul Davis <email@hidden>)
 >Re: scheduling a block from a render callback (From: Kyle Sluder <email@hidden>)
 >Re: scheduling a block from a render callback (From: Ross Bencina <email@hidden>)
 >Re: scheduling a block from a render callback (From: Kyle Sluder <email@hidden>)

  • Prev by Date: Re: scheduling a block from a render callback
  • Next by Date: Re: scheduling a block from a render callback
  • Previous by thread: Re: scheduling a block from a render callback
  • Next by thread: Re: scheduling a block from a render callback
  • Index(es):
    • Date
    • Thread