Skip to content

Commit 5245203

Browse files
committed
Avoid deadlock when waiting for line to be released
1 parent cc25d64 commit 5245203

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

core/src/main/java/xyz/gianlu/librespot/player/PlayerRunner.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,12 @@ public boolean pauseAndRelease() {
121121
*/
122122
public boolean stopAndRelease() {
123123
stopMixer();
124-
synchronized (pauseLock) {
125-
try {
126-
pauseLock.wait();
127-
} catch (InterruptedException ignored) {
124+
while (!paused) {
125+
synchronized (pauseLock) {
126+
try {
127+
pauseLock.wait(100);
128+
} catch (InterruptedException ignored) {
129+
}
128130
}
129131
}
130132

0 commit comments

Comments
 (0)