mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -08:00
Fix bug in synchronous monitor unlocking
This commit is contained in:
parent
84be461a69
commit
a96ee8a647
|
@ -56,6 +56,8 @@ public class TObject {
|
|||
}
|
||||
if (o.monitor.owner == null) {
|
||||
o.monitor.owner = TThread.currentThread();
|
||||
} else if (o.monitor.owner != TThread.currentThread()) {
|
||||
throw new IllegalStateException("Can't enter monitor from another thread synchronously");
|
||||
}
|
||||
o.monitor.count++;
|
||||
}
|
||||
|
@ -64,7 +66,9 @@ public class TObject {
|
|||
if (o.isEmptyMonitor() || o.monitor.owner != TThread.currentThread()) {
|
||||
throw new TIllegalMonitorStateException();
|
||||
}
|
||||
--o.monitor.count;
|
||||
if (--o.monitor.count == 0) {
|
||||
o.monitor.owner = null;
|
||||
}
|
||||
o.isEmptyMonitor();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user