Skip to content

Commit c02c2b0

Browse files
committed
more logging and waiting for threads
1 parent bca6dbf commit c02c2b0

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/runtime/PythonContext.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1750,15 +1750,24 @@ private void joinThreads() {
17501750
int tries = isOurThread ? 100 : 5;
17511751
for (int i = 0; i < tries && thread.isAlive(); i++) {
17521752
thread.join(tries - i);
1753+
if (!thread.isAlive()) {
1754+
break;
1755+
}
1756+
LOGGER.fine("Trying to join " + thread.getName() + " failed after " + (tries - i) + "ms.");
1757+
if (isOurThread) {
1758+
thread.interrupt();
1759+
thread.join(tries - i);
1760+
if (!thread.isAlive()) {
1761+
break;
1762+
}
1763+
LOGGER.fine("Trying to interrupt our " + thread.getName() + " failed after " + (tries - i) + "ms.");
1764+
}
17531765
env.submitThreadLocal(new Thread[]{thread}, new ThreadLocalAction(true, false) {
17541766
@Override
17551767
protected void perform(ThreadLocalAction.Access access) {
17561768
throw new PythonThreadKillException();
17571769
}
17581770
});
1759-
if (isOurThread) {
1760-
thread.interrupt();
1761-
}
17621771
}
17631772
if (isOurThread) {
17641773
// Thread#stop is not supported on SVM

0 commit comments

Comments
 (0)