• 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: Kyle Sluder <email@hidden>
  • Date: Tue, 14 Jan 2014 08:12:40 -0800

On Tue, Jan 14, 2014, at 06:06 AM, Paul Davis wrote:
> On Mon, Jan 13, 2014 at 9:39 PM, Doug Wyatt <email@hidden> wrote:
>
> > Some techniques that can be used safely from a realtime thread include:
> >
> > - signal a pthread condvar (but don't lock the associated mutex. this is
> > useful if you signal from the realtime thread continuously while you
> > continue to see the condition under which you want to wake the
> > lower-priority thread.)
> >
>
> I'd like to stress the continuously part of Doug's response here. If you
> do
> not do it continuously (and even if you do), then this method is subject
> to
> race conditions and in the worst case scenario (one involving developers
> who don't know enough about what they are doing), priority inversion.
> details here:
> https://groups.google.com/forum/?hl=ky#!msg/comp.programming.threads/wEUgPq541v8/ZByyyS8acqMJ
>
> Used carefully, though (where carefully means "correctly definining and
> understanding the relationship between the low priority ToBeWoken thread
> and the realtime thread(s)"), then this is a useful technique.

Given how frequently this comes up, I'm starting to wonder if there
shouldn't be API for this. Something like
AudioUnitPostNotificationAsync(uint32_t notification) and
AudioUnitAddNotificationHandler(dispatch_queue_t queue, void
(^handler)(AudioUnit unit)). Internally, AudioUnit would take care of
shunting waking a non-realtime thread that actually did the work of
dispatching the registered handlers to each queue.

--Kyle Sluder
 _______________________________________________
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: Ross Bencina <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>
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>)

  • 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