Skip to content

Commit 97cba27

Browse files
authored
Simplify startWorker pthread function. NFC (#24562)
This function doesn't need to take an argument or be declared in closure externs anymore. Split out from #24555
1 parent 380a5a1 commit 97cba27

8 files changed

+9
-13
lines changed

src/closure-externs/closure-externs.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,6 @@ var EMSCRIPTEN$AWAIT;
1919
// Don't minify createRequire
2020
var createRequire;
2121

22-
// Don't minify startWorker which we use to start workers once the runtime is ready.
23-
/**
24-
* @param {Object} Module
25-
*/
26-
var startWorker = function(Module) {};
27-
2822
// Closure externs used by library_sockfs.js
2923

3024
/**

src/preamble.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ function initRuntime() {
144144
#endif
145145

146146
#if PTHREADS
147-
if (ENVIRONMENT_IS_PTHREAD) return startWorker(Module);
147+
if (ENVIRONMENT_IS_PTHREAD) return startWorker();
148148
#endif
149149

150150
#if STACK_OVERFLOW_CHECK >= 2

src/runtime_pthread.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ var workerID = 0;
2020
var sharedModules = {};
2121
#endif
2222

23+
var startWorker;
24+
2325
if (ENVIRONMENT_IS_PTHREAD) {
2426
// Thread-local guard variable for one-time init of the JS state
2527
var initializedJS = false;
@@ -58,7 +60,7 @@ if (ENVIRONMENT_IS_PTHREAD) {
5860
self.onmessage = (e) => messageQueue.push(e);
5961

6062
// And add a callback for when the runtime is initialized.
61-
self.startWorker = (instance) => {
63+
startWorker = () => {
6264
// Notify the main thread that this thread has loaded.
6365
postMessage({ cmd: 'loaded' });
6466
// Process any messages that were queued before the thread was ready.

src/shell_minimal.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ function ready() {
127127
#if PTHREADS
128128
// This Worker is now ready to host pthreads, tell the main thread we can proceed.
129129
if (ENVIRONMENT_IS_PTHREAD) {
130-
startWorker(Module);
130+
startWorker();
131131
}
132132
#endif
133133
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3749
1+
3744
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7632
1+
7615
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3955
1+
3950
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8063
1+
8046

0 commit comments

Comments
 (0)