Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/lib/libpthread.js
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ var LibraryPThread = {
if (Module['mainScriptUrlOrBlob']) {
var pthreadMainJs = Module['mainScriptUrlOrBlob'];
if (typeof pthreadMainJs != 'string') {
pthreadMainJs = URL.createObjectURL(pthreadMainJs);
pthreadMainJs = PThread.blobURL ??= URL.createObjectURL(pthreadMainJs);
}
worker = new Worker(pthreadMainJs, {{{ pthreadWorkerOptions }}});
} else
Expand All @@ -481,8 +481,8 @@ var LibraryPThread = {
// due to CORS restrictions.
// https://github.com/emscripten-core/emscripten/issues/21937
if (ENVIRONMENT_IS_WEB) {
var url = URL.createObjectURL(new Blob([`import '${import.meta.url}'`], { type: 'application/javascript' }));
worker = new Worker(url, {{{ pthreadWorkerOptions }}});
PThread.blobURL ??= URL.createObjectURL(new Blob([`import '${import.meta.url}'`], { type: 'application/javascript' }));
worker = new Worker(PThread.blobURL, {{{ pthreadWorkerOptions }}});
} else
#endif
// We need to generate the URL with import.meta.url as the base URL of the JS file
Expand All @@ -500,7 +500,7 @@ var LibraryPThread = {
// itself does not allow this.
// https://github.com/emscripten-core/emscripten/issues/21937
if (ENVIRONMENT_IS_WEB) {
pthreadMainJs = URL.createObjectURL(new Blob([`importScripts('${_scriptName}')`], { type: 'application/javascript' }));
pthreadMainJs = PThread.blobURL ??= URL.createObjectURL(new Blob([`importScripts('${_scriptName}')`], { type: 'application/javascript' }));
}
#endif
#if expectToReceiveOnModule('mainScriptUrlOrBlob')
Expand All @@ -509,7 +509,7 @@ var LibraryPThread = {
if (Module['mainScriptUrlOrBlob']) {
pthreadMainJs = Module['mainScriptUrlOrBlob'];
if (typeof pthreadMainJs != 'string') {
pthreadMainJs = URL.createObjectURL(pthreadMainJs);
pthreadMainJs = PThread.blobURL ??= URL.createObjectURL(pthreadMainJs);
}
}
#endif
Expand Down Expand Up @@ -722,7 +722,7 @@ var LibraryPThread = {
#if ENVIRONMENT_MAY_BE_WEB
// Feature detect whether the main thread can block.
try {
Atomics.wait(HEAP32, 0, 0, 0)
Atomics.wait(HEAP32, 0, 0, 0);
can_block = true;
} catch (e) {}
#endif
Expand Down Expand Up @@ -1277,7 +1277,7 @@ var LibraryPThread = {
'_emscripten_thread_mailbox_await'],
$checkMailbox: () => {
// checkMailbox can be called after the pthread has shut down. See
// Pthread.terminateRuntime().
// PThread.terminateRuntime().
// In this case we return silently without re-registering using waitAsync.
// Perhaps there is a more universal way we can detect runtime has exited.
// TODO(https://github.com/emscripten-core/emscripten/issues/25076)
Expand Down
Loading