Changes to the SharedArrayBuffer API

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Changes to the SharedArrayBuffer API

Lars Hansen
The experimental SharedArrayBuffer has been enabled on Nightly (only) for some time.  If you were not aware of that you may stop reading now.

A change has landed (bug 1054886) that somewhat changes the API of SharedArrayBuffer.  In the past, one could construct TypedArray objects on a SharedArrayBuffer in the same manner as on an ArrayBuffer, and a SharedArrayBuffer could be used in other contexts as a substitute for ArrayBuffer.  That is no longer possible: shared memory and normal memory types are now distinct.  (The intuition is that code that is handed a shared memory object needs to be aware of that fact.)  To construct typed arrays on a SharedArrayBuffer, use the new SharedInt8Array (etc) types, and note there is no SharedDataView type at this time.  For other APIs that may have been applied to SharedArrayBuffer in the past, they may no longer work with SharedArrayBuffer and will be converted when we become aware of them and if conversion is deemed desirable/reasonable/practical.

More background here, including details about upcoming experimental APIs (comments are welcome):

dev-tech-js-engine mailing list
[hidden email]