Skip to content

Commit 3637300

Browse files
committed
Use a synchronous ThreadLocalAction for killing other threads
* That way we have a snapshot fo the currently-running fibers and avoid e.g. scheduling the action on 2 Fibers of the same thread. See the javadoc of Env#submitThreadLocal which say: > Already started synchronous actions will block on activation of a new thread. * Also this means we don't throw the KillException until all currently-running fibers have reached the safepoint. * Note that because of the throw this synchronous action will be exited quickly by all threads once all threads have reached the safepoint. So there is no concern about a nested safepoint or new threads staying blocked a long time. * This was the only ThreadLocalAction which affects multiple Ruby Threads and was asynchronous.
1 parent 4f0f612 commit 3637300

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/java/org/truffleruby/core/thread/ThreadManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ private void doKillOtherThreads() {
664664

665665
context.getSafepointManager().pauseAllThreadsAndExecute(
666666
DummyNode.INSTANCE,
667-
new SafepointAction("kill other threads for shutdown", predicate, true, false) {
667+
new SafepointAction("kill other threads for shutdown", predicate, true, true) {
668668
@Override
669669
public void run(RubyThread rubyThread, Node currentNode) {
670670
rubyThread.status = ThreadStatus.ABORTING;

0 commit comments

Comments
 (0)