On Sat, Sep 20, 2014 at 6:34 AM, Joe Berkovitz <joe@noteflight.com> wrote:
> On Sep 19, 2014, at 5:26 PM, Chris Wilson <cwilso@google.com> wrote:
>
> On which side? There is no such thing as synchronous across the thread
> boundary (there isn't today, either) - but on the main thread side your
> getter and setter would keep the value, as it would on the other side, so
> it would act as a synchronous property in each thread.
>
> Yes, I meant locally cached in the audio node, on the main thread side of
> the boundary, just as you said; I considered the value in the worker to be
> the true, non-cached working value. One could look at that either way, I
> think.
>
> By synchronous result, I meant synchronous in the ordinary sense: the
> caller of some function on the node gets a meaningful return value,
> immediately, with no thread handoff or callback needed. (A postMessage may
> have occurred invisibly under the hood but that's not part of delivering
> the return value.)
>
I think you will get that. The value will be maintained on each side, and
can be returned synchronously; it's possible, in a given scenario, they're
not in sync. E.g.:
(from main thread)
myOscillatorNode.type = "supersaw"; // sets type parameter, which calls
postMessage to set it on the audio worker side
console.log( myOscillatorNode.type ); // will log "supersaw" -
// although at this instant in time, the value on the worker side is
whatever it was before