Re: render callback + pthread_cond_signal
Re: render callback + pthread_cond_signal
- Subject: Re: render callback + pthread_cond_signal
- From: Paul Davis <email@hidden>
- Date: Fri, 29 Oct 2010 16:16:32 -0400
On Fri, Oct 29, 2010 at 4:05 PM, Ian Kemmish <email@hidden> wrote:
>
> On 28 Oct 2010, at 18:30, Scott Burgess <email@hidden> wrote:
>
>>
>> Is calling pthread_cond_signal() from an AU render callback cool?
>>
>> If not, what is the safe alternative to signal a UI or other thread?
>
>
> For those situations where you need to be absolutely certain that you're not
> going to block, I find the OSAtomic...() functions in libkern/OSAtomic.h
> useful. They map to the atomic compare-and-swap instructions on both PPC
> and Intel CPUs, and allow you to control exactly what's going on.
Just keep in mind that more than a few graves have been dug with
atomic operations used in lieu of locking. For use with well-defined
lock-free algorithms and data structures, they are incredibly useful.
As a replacement for locking, they are invariably a bad idea.
_______________________________________________
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