Skip to content

Commit 89c6159

Browse files
committed
Remove unneeded return <boolean>
1 parent d13f9f4 commit 89c6159

File tree

7 files changed

+7
-17
lines changed

7 files changed

+7
-17
lines changed

JavaScript/1-mutex.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,10 @@ class Mutex {
1818
Atomics.store(this.lock, 0, LOCKED);
1919
this.owner = true;
2020
setTimeout(callback, 0);
21-
return true;
2221
}
2322

2423
leave() {
25-
if (!this.owner) return false;
24+
if (!this.owner) return;
2625
Atomics.store(this.lock, 0, UNLOCKED);
2726
Atomics.notify(this.lock, 0, 1);
2827
this.owner = false;

JavaScript/2-deadlock.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,13 @@ class Mutex {
1818
Atomics.store(this.lock, 0, LOCKED);
1919
this.owner = true;
2020
setTimeout(callback, 0);
21-
return true;
2221
}
2322

2423
leave() {
25-
if (!this.owner) return false;
24+
if (!this.owner) return;
2625
Atomics.store(this.lock, 0, UNLOCKED);
2726
Atomics.notify(this.lock, 0, 1);
2827
this.owner = false;
29-
return true;
3028
}
3129
}
3230

JavaScript/3-livelock.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,13 @@ class Mutex {
2020
Atomics.store(this.lock, 0, LOCKED);
2121
this.owner = true;
2222
setTimeout(callback, 0);
23-
return true;
2423
}
2524

2625
leave() {
27-
if (!this.owner) return false;
26+
if (!this.owner) return;
2827
Atomics.store(this.lock, 0, UNLOCKED);
2928
Atomics.notify(this.lock, 0, 1);
3029
this.owner = false;
31-
return true;
3230
}
3331
}
3432

JavaScript/5-no-race.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,13 @@ class Mutex {
2020
prev = Atomics.exchange(this.lock, 0, LOCKED);
2121
}
2222
this.owner = true;
23-
return true;
2423
}
2524

2625
leave() {
27-
if (!this.owner) return false;
26+
if (!this.owner) return;
2827
Atomics.store(this.lock, 0, UNLOCKED);
2928
Atomics.notify(this.lock, 0, 1);
3029
this.owner = false;
31-
return true;
3230
}
3331
}
3432

JavaScript/6-blocking.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,10 @@ class Mutex {
2323
}
2424

2525
leave() {
26-
if (!this.owner) return false;
26+
if (!this.owner) return;
2727
Atomics.store(this.lock, 0, UNLOCKED);
2828
Atomics.notify(this.lock, 0, 1);
2929
this.owner = false;
30-
return true;
3130
}
3231
}
3332

JavaScript/7-spin-lock.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,10 @@ class Mutex {
2929
}
3030

3131
leave() {
32-
if (!this.owner) return false;
32+
if (!this.owner) return;
3333
Atomics.store(this.lock, 0, UNLOCKED);
3434
Atomics.notify(this.lock, 0, 1);
3535
this.owner = false;
36-
return true;
3736
}
3837
}
3938

JavaScript/8-async.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,10 @@ class Mutex {
4141
}
4242

4343
leave() {
44-
if (!this.owner) return false;
44+
if (!this.owner) return;
4545
Atomics.store(this.lock, 0, UNLOCKED);
4646
this.port.postMessage('leave');
4747
this.owner = false;
48-
return true;
4948
}
5049
}
5150

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