Fix infinite lock when overriding Thread.run and then joining it

This commit is contained in:
Alexey Andreev 2017-11-26 17:32:09 +03:00
parent cc04c3446d
commit 8fbf62ebac

View File

@ -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() {