[whatwg] ArrayBuffer and ByteArray questions
Kenneth Russell
kbr at google.com
Wed Sep 8 11:29:44 PDT 2010
On Wed, Sep 8, 2010 at 11:21 AM, Oliver Hunt <oliver at apple.com> wrote:
>
> On Sep 8, 2010, at 11:13 AM, Chris Marrin wrote:
>
>> Web Sockets is certainly another candidate, but I meant Web Workers. There have been informal discussions on using ArrayBuffers as a way to safely share binary data between threads. I don't believe anything has been formalized here.
>
> You can't share data between workers. There is no (and there cannot be) any shared state between multiple threads of JS execution.
Let's say "efficiently send" rather than "share". The current thinking
has been around a way to post one ArrayBuffer to a worker which would
"close" that ArrayBuffer and all views on the main thread. The way to
get the same backing store from the worker back to the main thread
would be to post the ArrayBuffer from the worker to the main thread,
at which point the ArrayBuffer and all views on the worker would be
"closed". This ping-ponging would allow efficient implementation of
producer/consumer queues without allocating new backing store each
time the worker wants to produce something for the main thread.
This would require some small API additions to the typed array spec,
and a prototype so we can convince ourselves of its effectiveness.
-Ken
More information about the whatwg
mailing list