mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-11-07 19:31:45 +01:00
Prevented synchronization issue with UnitSemaphoreAccessLock
Using the boolean outside of the synchronized block might have caused issues.
This commit is contained in:
parent
2c9c691b4f
commit
5c01cde102
@ -35,20 +35,20 @@ public class UnitSemaphoreAccessLock {
|
||||
|
||||
public void enter() {
|
||||
try {
|
||||
if (accessing.get()) {
|
||||
synchronized (lockObject) {
|
||||
synchronized (lockObject) {
|
||||
if (accessing.get()) {
|
||||
lockObject.wait();
|
||||
}
|
||||
accessing.set(true);
|
||||
}
|
||||
accessing.set(true);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
|
||||
public void exit() {
|
||||
accessing.set(false);
|
||||
synchronized (lockObject) {
|
||||
accessing.set(false);
|
||||
lockObject.notify();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user