You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In that case we have just the custom EXPORT_NAME in
the global scope, and must connect to that properly in
the worker.js file which only sees the global scope.
Also we cannot use out()/err() for logging as those are
internals of the emitted code, which in MODULARIZE*
mode are not available to worker.js as well.
fixes#9091
Copy file name to clipboardExpand all lines: src/worker.js
+19-7Lines changed: 19 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -12,10 +12,15 @@ var threadInfoStruct = 0; // Info area for this thread in Emscripten HEAP (share
12
12
varselfThreadId=0;// The ID of this thread. 0 if not hosting a pthread.
13
13
varparentThreadId=0;// The ID of the parent pthread that launched this thread.
14
14
15
-
// Cannot use console.log or console.error in a web worker, since that would risk a browser deadlock! https://bugzilla.mozilla.org/show_bug.cgi?id=1049091
16
-
// Therefore implement custom logging facility for threads running in a worker, which queue the messages to main thread to print.
17
15
varModule={};
18
16
17
+
// If we use a custom export name, refer to Module from it as well, so that
18
+
// we connect properly to the modularized instance which is the only thing
19
+
// in the global scope.
20
+
#if MODULARIZE_INSTANCE&&EXPORT_NAME!='Module'
21
+
var{{{EXPORT_NAME}}}=Module;
22
+
#endif
23
+
19
24
#if ASSERTIONS
20
25
functionassert(condition,text){
21
26
if(!condition)abort('Assertion failed: '+text);
@@ -25,12 +30,19 @@ function assert(condition, text) {
// else e == 'unwind', and we should fall through here and keep the pthread alive for asynchronous events.
261
-
out('Pthread 0x'+threadInfoStruct.toString(16)+' completed its pthread main entry point with an unwind, keeping the pthread worker alive for asynchronous operation.');
273
+
err('Pthread 0x'+threadInfoStruct.toString(16)+' completed its pthread main entry point with an unwind, keeping the pthread worker alive for asynchronous operation.');
0 commit comments