From: Paul Davis <email@hidden>
To: Morgan Packard <email@hidden>
Cc: email@hidden
Sent: Sat, March 26, 2011 6:00:50 PM
Subject: Re: best practices for
sending data from UI to RemoteIO callback thread
On Sat, Mar 26, 2011 at 5:57 PM, Paul Davis <
email@hidden> wrote:
> On Sat, Mar 26, 2011 at 5:45 PM, Morgan Packard
> <
email@hidden> wrote:
>> Great. Thanks. This had occurred to me as something that I should
>> maybe be doing, but had been told that it probably wasn't necessary.
>> Specifically, I'm triggering envelopes from my UI thread, which
>> involves resetting the "current value" member variable of the
>> envelope. I had been advised that a simple assignment of a float value
>> wasn't likely to result in threading problems. But perhaps this isn't
>> safe after all.
>
> there are two separate issues.
i missed one aspect of this: linked
parameters. suppose you have a
synthesis engine with two parameters. it will *not* be safe, in
general, to rely on the atomicity of a basic variable type to update
the engine's parameters, because there is absolutely no guarantee that
the engine will not execute at a time where only one of the parameters
has been modified.
you can make this "safe" in a couple of ways:
* make sure that the engine will never do anything wrong no matter
what the parameter values are, and interpolate changes in parameters
so that
there are never abrupt changes
* use lock free data structures to deliver the new values to the engine
* not use linked parameters in your engine (this is a bit limiting :)
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (
_______________________________________________
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