-
-
Notifications
You must be signed in to change notification settings - Fork 32k
worker: implement Web Locks API #36502
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
84ab409
949b24d
87feb3a
0fed56d
a4f7cf0
0403239
f30da92
3eaa2ce
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,6 +85,7 @@ let debug = require('internal/util/debuglog').debuglog('worker', (fn) => { | |
}); | ||
|
||
let cwdCounter; | ||
let locksInitialized = false; | ||
|
||
if (isMainThread) { | ||
cwdCounter = new Uint32Array(new SharedArrayBuffer(4)); | ||
|
@@ -166,6 +167,13 @@ class Worker extends EventEmitter { | |
options.env); | ||
} | ||
|
||
if (isMainThread && !locksInitialized) { | ||
locksInitialized = true; | ||
// Make sure that locks are initialized before active | ||
// multithreading starts. | ||
require('worker_threads').locks.query(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tiny nit: This is kind of implicit - I would prefer it if this was more explicit (like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well … I can add another method, but I don’t think |
||
} | ||
|
||
// Set up the C++ handle for the worker, as well as some internal wiring. | ||
this[kHandle] = new WorkerImpl(url, | ||
env === process.env ? null : env, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
Uh oh!
There was an error while loading. Please reload this page.