Skip to content

Commit fe2e786

Browse files
committed
Wrap console.dir to critical section
1 parent 7fb8674 commit fe2e786

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

JavaScript/5-no-race.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@ if (isMainThread) {
8181
point.move(1, 1);
8282
mutex.leave();
8383
}
84+
await mutex.enter();
8485
console.dir({ point });
86+
mutex.leave();
8587
})();
8688
} else {
8789
(async () => {
@@ -90,7 +92,9 @@ if (isMainThread) {
9092
point.move(-1, -1);
9193
mutex.leave();
9294
}
95+
await mutex.enter();
9396
console.dir({ point });
97+
mutex.leave();
9498
})();
9599
}
96100
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy