Skip to content

Commit

Permalink
Move threading helper function to library_atomic.js. NFC
Browse files Browse the repository at this point in the history
These utility function are not specifically related pthreads so move
them to a file that is included also when SHARED_MEMORY/WASM_WORKERS
are used.
  • Loading branch information
sbc100 committed Oct 11, 2024
1 parent c4b200c commit 7801ba5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 8 additions & 0 deletions src/library_atomic.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,12 @@ addToLibrary({
});
return numCancelled;
},

emscripten_has_threading_support: () => typeof SharedArrayBuffer != 'undefined',

emscripten_num_logical_cores: () =>
#if ENVIRONMENT_MAY_BE_NODE
ENVIRONMENT_IS_NODE ? require('os').cpus().length :
#endif
navigator['hardwareConcurrency'],
});
8 changes: 0 additions & 8 deletions src/library_pthread.js
Original file line number Diff line number Diff line change
Expand Up @@ -647,14 +647,6 @@ var LibraryPThread = {
return 0;
},
emscripten_has_threading_support: () => typeof SharedArrayBuffer != 'undefined',
emscripten_num_logical_cores: () =>
#if ENVIRONMENT_MAY_BE_NODE
ENVIRONMENT_IS_NODE ? require('os').cpus().length :
#endif
navigator['hardwareConcurrency'],
_emscripten_init_main_thread_js: (tb) => {
// Pass the thread address to the native code where they stored in wasm
// globals which act as a form of TLS. Global constructors trying
Expand Down

0 comments on commit 7801ba5

Please sign in to comment.