Skip to content

Commit 0d2cdb1

Browse files
committed
Updated to GitHub Actions comments.
1 parent dd45cb0 commit 0d2cdb1

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

Diff for: twin/README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,17 @@ public class BallThread extends Thread {
9090
public void run() {
9191
synchronized (this) {
9292
while (isRunning) {
93-
while (isSuspended) {
93+
while (isSuspended && isRunning) {
9494
try {
9595
wait();
9696
} catch (InterruptedException e) {
9797
Thread.currentThread().interrupt();
9898
return;
9999
}
100100
}
101+
102+
if (!isRunning) break;
103+
101104
twin.draw();
102105
twin.move();
103106
try {

Diff for: twin/src/main/java/com/iluwatar/twin/BallThread.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,18 @@ public class BallThread extends Thread {
5050
public void run() {
5151
synchronized (this) {
5252
while (isRunning) {
53-
while (isSuspended) {
53+
while (isSuspended && isRunning) {
5454
try {
5555
wait(); // Puts the thread in waiting state.
5656
} catch (InterruptedException e) {
5757
Thread.currentThread().interrupt(); // Restores the interruption.
5858
return;
5959
}
6060
}
61+
62+
if (!isRunning)
63+
break; // Secures clean exit
64+
6165
twin.draw();
6266
twin.move();
6367
try {

0 commit comments

Comments
 (0)