@@ -11,9 +11,6 @@ const {
|
11 | 11 | ObjectDefineProperty, |
12 | 12 | PromisePrototypeThen, |
13 | 13 | RegExpPrototypeExec, |
14 | | -globalThis: { |
15 | | - SharedArrayBuffer, |
16 | | -}, |
17 | 14 | } = primordials; |
18 | 15 | |
19 | 16 | const { |
@@ -119,23 +116,21 @@ port.on('message', (message) => {
|
119 | 116 | require('internal/worker').assignEnvironmentData(environmentData); |
120 | 117 | setupMainThreadPort(mainThreadPort); |
121 | 118 | |
122 | | -if (SharedArrayBuffer !== undefined) { |
123 | | -// The counter is only passed to the workers created by the main thread, |
124 | | -// not to workers created by other workers. |
125 | | -let cachedCwd = ''; |
126 | | -let lastCounter = -1; |
127 | | -const originalCwd = process.cwd; |
128 | | - |
129 | | -process.cwd = function() { |
130 | | -const currentCounter = AtomicsLoad(cwdCounter, 0); |
131 | | -if (currentCounter === lastCounter) |
132 | | -return cachedCwd; |
133 | | -lastCounter = currentCounter; |
134 | | -cachedCwd = originalCwd(); |
| 119 | +// The counter is only passed to the workers created by the main thread, |
| 120 | +// not to workers created by other workers. |
| 121 | +let cachedCwd = ''; |
| 122 | +let lastCounter = -1; |
| 123 | +const originalCwd = process.cwd; |
| 124 | + |
| 125 | +process.cwd = function() { |
| 126 | +const currentCounter = AtomicsLoad(cwdCounter, 0); |
| 127 | +if (currentCounter === lastCounter) |
135 | 128 | return cachedCwd; |
136 | | -}; |
137 | | -workerIo.sharedCwdCounter = cwdCounter; |
138 | | -} |
| 129 | +lastCounter = currentCounter; |
| 130 | +cachedCwd = originalCwd(); |
| 131 | +return cachedCwd; |
| 132 | +}; |
| 133 | +workerIo.sharedCwdCounter = cwdCounter; |
139 | 134 | |
140 | 135 | const isLoaderHookWorker = (filename === 'internal/modules/esm/worker' && doEval === 'internal'); |
141 | 136 | if (!isLoaderHookWorker) { |
|