Skip to content

Commit 75581bf

Browse files
committed
Don't retry GIL acquisition on thread exit
1 parent ba52c86 commit 75581bf

File tree

1 file changed

+6
-0
lines changed
  • graalpython/com.oracle.graal.python/src/com/oracle/graal/python/runtime

1 file changed

+6
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@
4141

4242
package com.oracle.graal.python.runtime;
4343

44+
import com.oracle.graal.python.runtime.exception.PythonExitException;
45+
import com.oracle.graal.python.runtime.exception.PythonThreadKillException;
4446
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
4547
import com.oracle.truffle.api.TruffleSafepoint;
4648
import com.oracle.truffle.api.dsl.NeverDefault;
@@ -90,6 +92,8 @@ public boolean acquire(PythonContext context, Node location) {
9092
if (binaryProfile.profile(!context.ownsGil())) {
9193
try {
9294
TruffleSafepoint.setBlockedThreadInterruptible(location, PythonContext::acquireGil, context);
95+
} catch (PythonThreadKillException | PythonExitException | ThreadDeath e) {
96+
throw e;
9397
} catch (Throwable t) {
9498
/*
9599
* Safepoint actions may throw exceptions, so we need to make sure that we
@@ -141,6 +145,8 @@ public final boolean acquire(PythonContext context, Node location) {
141145
if (!context.tryAcquireGil()) {
142146
try {
143147
TruffleSafepoint.setBlockedThreadInterruptible(location, PythonContext::acquireGil, context);
148+
} catch (PythonThreadKillException | PythonExitException | ThreadDeath e) {
149+
throw e;
144150
} catch (Throwable t) {
145151
/*
146152
* Safepoint actions may throw exceptions, so we need to make sure that we

0 commit comments

Comments
 (0)