MCPcopy Index your code
hub / github.com/MultithreadedJSBook/code-samples / release

Method release

ch6-mutex/mutex.js:22–27  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

20 }
21
22 release() {
23 if (compareExchange(this.shared, this.index, LOCKED, UNLOCKED) !== LOCKED) {
24 throw new Error('was not acquired');
25 }
26 notify(this.shared, this.index, 1);
27 }
28
29 exec(fn) {
30 this.acquire();

Callers 1

execMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected