diff --git a/classlib/src/main/java/org/teavm/classlib/java/lang/TThread.java b/classlib/src/main/java/org/teavm/classlib/java/lang/TThread.java index 038df91a4..1e6cfdf4d 100644 --- a/classlib/src/main/java/org/teavm/classlib/java/lang/TThread.java +++ b/classlib/src/main/java/org/teavm/classlib/java/lang/TThread.java @@ -62,6 +62,9 @@ public class TThread extends TObject implements TRunnable { setCurrentThread(TThread.this); TThread.this.run(); } finally { + synchronized (finishedLock) { + finishedLock.notifyAll(); + } alive = false; activeCount--; setCurrentThread(mainThread); @@ -85,9 +88,6 @@ public class TThread extends TObject implements TRunnable { if (target != null) { target.run(); } - synchronized (finishedLock) { - finishedLock.notifyAll(); - } } public static TThread currentThread() {