Re: scheduling a block from a render callback
Re: scheduling a block from a render callback
- Subject: Re: scheduling a block from a render callback
- From: Ian Kemmish <email@hidden>
- Date: Wed, 08 Jan 2014 07:38:57 +0000
On 7 Jan 2014, at 17:44:37 -0800, Lucas Ives <email@hidden> wrote:
> I could pass data through a lock-free pipe back to another thread and
> poll its existence, but my blocks have the property that they both need
> to fire as soon as possible and also are used (relatively)
> infrequently... so it seems like a waste to be constantly polling for
> them using NSTimer or the like.
Being an old codger, I occasionally find myself saying things like that - until I remember that these days, I'm very unlikely to end up running code on a single-CPU machine :-) Polling isn't as wasteful as it used to be.
If you are polling, then a single byte variable accessible to both threads is even simpler than a fifo, of course.
My synth needs the real-time thread to co-ordinate with a memory allocator running in a separate thread, which is also "urgent" and "relatively infrequent". I use the macros in libkern/OSAtomic.h, which seem to be the lowest-overhead synchronisation primitives. I can't remember offhand which of those are non-blocking, but there's documentation somewhere....
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Ian Kemmish 18 Durham Close, Biggleswade, Beds SG18 8HZ
email@hidden Tel: +44 1767 601361 Mob: +44 7952 854387
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
_______________________________________________
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