On Sun, Sep 28, 2014 at 3:33 PM, idleman <[email protected]> wrote:
> I have maybe a hard question for you guys, but probably a interesting one
> and
> would be very happy if you can at least give me some hint/information in
> this
> subject.
>
> Say you construct a new v8::ArrayBuffer from a raw bit of memory:
>
> auto handle = v8::ArrayBuffer::New(Isolate* isolate, void* data, size_t
> byte_length);
>
> What will occur if "void* data" points to a shared memory which is shared
> among
> multiple processes? Will it act as expected? Will all changes to ArrayBuffer
> be
> immediately visible for all processes/JavaScript code?
>
> I have not tested this, so I just wonder if it actually can work, if I
> synchronize all
> read/write calls from/to ArrayBuffer? v8 will not randomly read/write to the
> ArrayBuffer internally, is that an correct assumption?
>
> All thoughts are welcome,
>
> Thanks in advance :-)

It's probably a bad idea to expose shared memory to JS.  The JS memory
model has no concept of threads or concurrent memory access.

V8 is fairly conservative with loads and stores to typed arrays but
that is an implementation detail, not a guarantee.  It doesn't issue
memory barriers so there is no guarantee that two threads will see
loads and stores in the same order.

-- 
-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to