File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
graalpython/com.oracle.graal.python/src/com/oracle/graal/python/runtime Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change 44
44
import java .util .concurrent .ConcurrentLinkedQueue ;
45
45
import java .util .concurrent .Executors ;
46
46
import java .util .concurrent .ScheduledExecutorService ;
47
+ import java .util .concurrent .ThreadFactory ;
47
48
import java .util .concurrent .TimeUnit ;
48
49
import java .util .concurrent .locks .Lock ;
49
50
import java .util .concurrent .locks .ReentrantLock ;
@@ -91,7 +92,13 @@ default int frameIndex() {
91
92
}
92
93
}
93
94
94
- private final ScheduledExecutorService executorService = Executors .newScheduledThreadPool (2 );
95
+ private final ScheduledExecutorService executorService = Executors .newScheduledThreadPool (2 , new ThreadFactory () {
96
+ public Thread newThread (Runnable r ) {
97
+ Thread t = Executors .defaultThreadFactory ().newThread (r );
98
+ t .setDaemon (true );
99
+ return t ;
100
+ }
101
+ });
95
102
private final ConcurrentLinkedQueue <AsyncAction > scheduledActions = new ConcurrentLinkedQueue <>();
96
103
private boolean hasScheduledAction = false ;
97
104
private final Lock executingScheduledActions = new ReentrantLock ();
@@ -224,4 +231,8 @@ private void processAsyncActions() {
224
231
}
225
232
}
226
233
}
234
+
235
+ public void shutdown () {
236
+ executorService .shutdownNow ();
237
+ }
227
238
}
Original file line number Diff line number Diff line change @@ -288,6 +288,7 @@ public void deregisterShutdownHook(Object callable) {
288
288
289
289
@ TruffleBoundary
290
290
public void runShutdownHooks () {
291
+ handler .shutdown ();
291
292
for (CallTarget f : atExitHooks .values ()) {
292
293
f .call ();
293
294
}
You can’t perform that action at this time.
0 commit comments