Fix infinite lock when overriding Thread.run and then joining it
@@ -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() {
