Skip to content

Commit 7fdd5a2

Browse files
frolovdevtshemsedinov
authored andcommitted
Update load call in semaphore
1 parent 638633e commit 7fdd5a2

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

JavaScript/6-counting-safe.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class CountingSemaphore {
1515
enter() {
1616
while (true) {
1717
Atomics.wait(this.counter, 0, 0);
18-
const n = Atomics.load(this.counter, 0, 1);
18+
const n = Atomics.load(this.counter, 0);
1919
if (n > 0) {
2020
const prev = Atomics.compareExchange(this.counter, 0, n, n - 1);
2121
if (prev === n) return;

0 commit comments

Comments
 (0)