mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2025-01-08 07:54:11 -08:00
Fixes threading issue in DependencyChecker
This commit is contained in:
parent
2214433d6c
commit
ca29e10aeb
|
@ -106,7 +106,9 @@ public class DependencyChecker {
|
||||||
}
|
}
|
||||||
|
|
||||||
void schedule(final Runnable runnable) {
|
void schedule(final Runnable runnable) {
|
||||||
activeTaskCount.incrementAndGet();
|
synchronized (activeTaskMonitor) {
|
||||||
|
activeTaskCount.incrementAndGet();
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
executor.execute(new Runnable() {
|
executor.execute(new Runnable() {
|
||||||
@Override public void run() {
|
@Override public void run() {
|
||||||
|
@ -117,8 +119,8 @@ public class DependencyChecker {
|
||||||
exceptionOccured.compareAndSet(null, e);
|
exceptionOccured.compareAndSet(null, e);
|
||||||
executor.shutdownNow();
|
executor.shutdownNow();
|
||||||
}
|
}
|
||||||
if (activeTaskCount.decrementAndGet() == 0) {
|
synchronized (activeTaskMonitor) {
|
||||||
synchronized (activeTaskMonitor) {
|
if (activeTaskCount.decrementAndGet() == 0) {
|
||||||
activeTaskMonitor.notifyAll();
|
activeTaskMonitor.notifyAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -131,11 +133,11 @@ public class DependencyChecker {
|
||||||
|
|
||||||
public void checkDependencies() {
|
public void checkDependencies() {
|
||||||
while (true) {
|
while (true) {
|
||||||
if (activeTaskCount.get() == 0 || exceptionOccured.get() != null) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
synchronized (activeTaskMonitor) {
|
synchronized (activeTaskMonitor) {
|
||||||
|
if (activeTaskCount.get() == 0 || exceptionOccured.get() != null) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
activeTaskMonitor.wait();
|
activeTaskMonitor.wait();
|
||||||
}
|
}
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
|
|
|
@ -252,7 +252,7 @@ class ClassRefsRenamer implements InstructionVisitor {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void visit(InvokeInstruction insn) {
|
public void visit(InvokeInstruction insn) {
|
||||||
String className = classNameMapper.map(insn.getMethod().getClassName());
|
String className = classNameMapper.map(insn.getMethod().getClassName());
|
||||||
ValueType[] signature = insn.getMethod().getSignature();
|
ValueType[] signature = insn.getMethod().getSignature();
|
||||||
for (int i = 0; i < signature.length; ++i) {
|
for (int i = 0; i < signature.length; ++i) {
|
||||||
signature[i] = rename(signature[i]);
|
signature[i] = rename(signature[i]);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user