Skip to content

Commit 49d2bd7

Browse files
authored
Move threading helper functions to library_atomic.js. NFC (#22723)
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.
1 parent af5c597 commit 49d2bd7

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/library_atomic.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,4 +148,12 @@ addToLibrary({
148148
});
149149
return numCancelled;
150150
},
151+
152+
emscripten_has_threading_support: () => typeof SharedArrayBuffer != 'undefined',
153+
154+
emscripten_num_logical_cores: () =>
155+
#if ENVIRONMENT_MAY_BE_NODE
156+
ENVIRONMENT_IS_NODE ? require('os').cpus().length :
157+
#endif
158+
navigator['hardwareConcurrency'],
151159
});

src/library_pthread.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -647,14 +647,6 @@ var LibraryPThread = {
647647
return 0;
648648
},
649649

650-
emscripten_has_threading_support: () => typeof SharedArrayBuffer != 'undefined',
651-
652-
emscripten_num_logical_cores: () =>
653-
#if ENVIRONMENT_MAY_BE_NODE
654-
ENVIRONMENT_IS_NODE ? require('os').cpus().length :
655-
#endif
656-
navigator['hardwareConcurrency'],
657-
658650
_emscripten_init_main_thread_js: (tb) => {
659651
// Pass the thread address to the native code where they stored in wasm
660652
// globals which act as a form of TLS. Global constructors trying

0 commit comments

Comments
 (0)