@ -1,3 +1,8 @@
function SUPPORTS _SHARED _MEMORY ( ) {
return typeof ( SharedArrayBuffer ) !== 'undefined' ;
}
// Support for growable heap + pthreads, where the buffer may change, so JS views
// Support for growable heap + pthreads, where the buffer may change, so JS views
// must be updated.
// must be updated.
function GROWABLE _HEAP _STORE _I8 ( ptr , value ) {
function GROWABLE _HEAP _STORE _I8 ( ptr , value ) {
@ -1030,7 +1035,7 @@ if (ENVIRONMENT_IS_PTHREAD) {
"maximum" : 1073741824 / WASM _PAGE _SIZE ,
"maximum" : 1073741824 / WASM _PAGE _SIZE ,
"shared" : true
"shared" : true
} ) ;
} ) ;
if ( ! ( wasmMemory . buffer instanceof SharedArrayBuffer ) ) {
if ( Object . prototype . toString . call ( wasmMemory . buffer ) !== '[object SharedArrayBuffer]' ) {
err ( "requested a shared WebAssembly.Memory but the returned buffer is not a SharedArrayBuffer, indicating that while the browser has SharedArrayBuffer it does not have WebAssembly threads support - you may need to set a flag" ) ;
err ( "requested a shared WebAssembly.Memory but the returned buffer is not a SharedArrayBuffer, indicating that while the browser has SharedArrayBuffer it does not have WebAssembly threads support - you may need to set a flag" ) ;
if ( ENVIRONMENT _HAS _NODE ) {
if ( ENVIRONMENT _HAS _NODE ) {
console . log ( "(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and also use a recent version)" ) ;
console . log ( "(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and also use a recent version)" ) ;
@ -2161,7 +2166,7 @@ var PThread = {
} ) ,
} ) ,
receiveObjectTransfer : ( function ( data ) { } ) ,
receiveObjectTransfer : ( function ( data ) { } ) ,
allocateUnusedWorkers : ( function ( numWorkers , onFinishedLoading ) {
allocateUnusedWorkers : ( function ( numWorkers , onFinishedLoading ) {
if ( typeof SharedArrayBuffer === "undefined" ) return ;
if ( ! SUPPORTS _SHARED _MEMORY ( ) ) return ;
var workers = [ ] ;
var workers = [ ] ;
var numWorkersToCreate = numWorkers ;
var numWorkersToCreate = numWorkers ;
if ( PThread . preallocatedWorkers . length > 0 ) {
if ( PThread . preallocatedWorkers . length > 0 ) {
@ -2276,7 +2281,7 @@ var PThread = {
}
}
} ) ,
} ) ,
createNewWorkers : ( function ( numWorkers ) {
createNewWorkers : ( function ( numWorkers ) {
if ( typeof SharedArrayBuffer === "undefined" ) return [ ] ;
if ( ! SUPPORTS _SHARED _MEMORY ( ) ) return [ ] ;
var pthreadMainJs = "x2t.worker.js" ;
var pthreadMainJs = "x2t.worker.js" ;
pthreadMainJs = locateFile ( pthreadMainJs ) ;
pthreadMainJs = locateFile ( pthreadMainJs ) ;
var newWorkers = [ ] ;
var newWorkers = [ ] ;
@ -5683,7 +5688,7 @@ function _emscripten_get_sbrk_ptr() {
}
}
Module [ "_emscripten_get_sbrk_ptr" ] = _emscripten _get _sbrk _ptr ;
Module [ "_emscripten_get_sbrk_ptr" ] = _emscripten _get _sbrk _ptr ;
function _emscripten _has _threading _support ( ) {
function _emscripten _has _threading _support ( ) {
return typeof SharedArrayBuffer !== "undefined" ;
return SUPPORTS _SHARED _MEMORY ( ) ;
}
}
Module [ "_emscripten_has_threading_support" ] = _emscripten _has _threading _support ;
Module [ "_emscripten_has_threading_support" ] = _emscripten _has _threading _support ;
function _emscripten _is _main _browser _thread ( ) {
function _emscripten _is _main _browser _thread ( ) {
@ -6761,7 +6766,7 @@ function _pthread_self() {
}
}
Module [ "_pthread_self" ] = _pthread _self ;
Module [ "_pthread_self" ] = _pthread _self ;
function _pthread _create ( pthread _ptr , attr , start _routine , arg ) {
function _pthread _create ( pthread _ptr , attr , start _routine , arg ) {
if ( typeof SharedArrayBuffer === "undefined" ) {
if ( ! SUPPORTS _SHARED _MEMORY ( ) ) {
err ( "Current environment does not support SharedArrayBuffer, pthreads are not available!" ) ;
err ( "Current environment does not support SharedArrayBuffer, pthreads are not available!" ) ;
return 6 ;
return 6 ;
}
}