mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
use synchronized block to avoid IllegalMonitorStateException
This commit is contained in:
@@ -53,7 +53,9 @@ public final class FetchForegroundService extends Service {
|
||||
try {
|
||||
// The `wait()` needs to be enclosed in a while loop because there may be
|
||||
// "spurious wake-ups", i.e. `wait()` may return even though `notifyAll()` wasn't called.
|
||||
STOP_NOTIFIER.wait();
|
||||
synchronized (STOP_NOTIFIER) {
|
||||
STOP_NOTIFIER.wait();
|
||||
}
|
||||
} catch (InterruptedException ex) { }
|
||||
}
|
||||
}
|
||||
@@ -63,7 +65,9 @@ public final class FetchForegroundService extends Service {
|
||||
public static void stop(Context context) {
|
||||
if (fetchingSynchronously) {
|
||||
fetchingSynchronously = false;
|
||||
STOP_NOTIFIER.notifyAll();
|
||||
synchronized (STOP_NOTIFIER) {
|
||||
STOP_NOTIFIER.notifyAll();
|
||||
}
|
||||
}
|
||||
|
||||
synchronized (SERVICE_LOCK) {
|
||||
|
||||
Reference in New Issue
Block a user