Skip to content

Commit

Permalink
fix deadlock
Browse files Browse the repository at this point in the history
  • Loading branch information
lictex committed Oct 2, 2019
1 parent c4fc1de commit 45c59ba
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions app/src/main/java/pw/lictex/osuplayer/audio/AudioEngine.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@ private void runOnAudioThreadSync(Runnable r) {
}
try {
var lock = new Object();
synchronized (audioThread.eventQueue) {
audioThread.eventQueue.offer(() -> {
r.run();
synchronized (lock) {
lock.notifyAll();
}
});
}
synchronized (lock) {
synchronized (audioThread.eventQueue) {
audioThread.eventQueue.offer(() -> {
synchronized (lock) {
r.run();
lock.notifyAll();
}
});
}
lock.wait();
}
} catch (InterruptedException e) {
Expand Down

0 comments on commit 45c59ba

Please sign in to comment.