Skip to content

Commit 0febee8

Browse files
authored
Move sharedModules object to runtime_pthread.js (emscripten-core#23998)
1 parent ebbc200 commit 0febee8

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

src/postamble.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,6 @@ function stackCheckInit() {
132132
}
133133
#endif
134134

135-
#if MAIN_MODULE && PTHREADS
136-
// Map of modules to be shared with new threads. This gets populated by the
137-
// main thread and shared with all new workers via the initial `load` message.
138-
var sharedModules = {};
139-
#endif
140-
141135
#if MAIN_READS_PARAMS
142136
function run(args = arguments_) {
143137
#else

src/runtime_pthread.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@
1414
var workerID = 0;
1515
#endif
1616

17+
#if MAIN_MODULE
18+
// Map of modules to be shared with new threads. This gets populated by the
19+
// main thread and shared with all new workers via the initial `load` message.
20+
var sharedModules = {};
21+
#endif
22+
1723
if (ENVIRONMENT_IS_PTHREAD) {
1824
#if !MINIMAL_RUNTIME
1925
var wasmModuleReceived;

test/test_other.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2176,6 +2176,7 @@ def test(link_flags, lib_suffix):
21762176
test(['libdir/libfile.so.3.1.4.1.5.9'], '.3.1.4.1.5.9') # handle libX.so.1.2.3 as well
21772177

21782178
@node_pthreads
2179+
@also_with_modularize
21792180
def test_dylink_pthread_static_data(self):
21802181
# Test that a side module uses the same static data region for global objects across all threads
21812182

@@ -15272,7 +15273,7 @@ def test_preload_module(self, args):
1527215273

1527315274
// Check that it was preloaded.
1527415275
// The preloading actually only happens on the main thread where the filesystem
15275-
// lives. On worker threads the module object is shared via preloadedModules.
15276+
// lives. On worker threads the module object is shared via sharedModules.
1527615277
if (emscripten_is_main_runtime_thread()) {
1527715278
int found = EM_ASM_INT(
1527815279
return preloadedWasm['/library.so'] !== undefined;

0 commit comments

Comments
 (0)