Skip to content

Commit dd45cb0

Browse files
committed
Synchronization updated thanks to GitHub Actions.
1 parent 9f34b25 commit dd45cb0

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Diff for: twin/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,14 @@ public class BallThread extends Thread {
117117

118118
public synchronized void resumeMe() {
119119
isSuspended = false;
120-
notify();
120+
notifyAll();
121121
LOGGER.info("Resuming BallThread");
122122
}
123123

124124
public synchronized void stopMe() {
125125
isRunning = false;
126126
isSuspended = false;
127-
notify();
127+
notifyAll();
128128
}
129129
}
130130
```

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,13 @@ public synchronized void suspendMe() {
7777

7878
public synchronized void resumeMe() {
7979
isSuspended = false;
80-
notify(); // Wakes up the thread from waiting state.
80+
notifyAll(); // Wakes up the thread from waiting state (prevents lost wake-ups).
8181
LOGGER.info("Resuming BallThread");
8282
}
8383

8484
public synchronized void stopMe() {
8585
isRunning = false;
8686
isSuspended = false;
87-
notify(); // Makes sure the thread wakes up and exits (stops).
87+
notifyAll(); // Makes sure the thread wakes up and exits (prevents lost wake-ups).
8888
}
8989
}

0 commit comments

Comments
 (0)