Skip to content

Commit 4b7d81b

Browse files
committed
[GR-40931] Fixes for --virtual-thread-fibers
PullRequest: truffleruby/4206
2 parents c1900b4 + 3d23dc0 commit 4b7d81b

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,12 @@ public Thread createFiberJavaThread(RubyFiber fiber, SourceSection sourceSection
185185
body.run();
186186
} finally {
187187
truffleContext.leave(node, prev);
188+
189+
// For PolyglotThread, the order is leave(), disposeThread(), afterLeave(), as desired.
190+
// But for an "embedder thread" like this one, disposeThread() is only done just before disposeContext(),
191+
// so we do the disposeThread() logic here to release the CountDownLatch and let doKillOtherFibers() proceed.
192+
context.fiberManager.cleanup(fiber, Thread.currentThread());
193+
188194
afterLeave.run();
189195
}
190196
});

src/options.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ EXPERT:
103103
LAZY_TRANSLATION_USER: [lazy-translation-user, boolean, LAZY_CALLTARGETS, 'Lazily translation of stdlib, gem and user source files']
104104
PATCHING: [patching, boolean, true, Use patching]
105105
HASHING_DETERMINISTIC: [hashing-deterministic, boolean, false, Produce deterministic hash values]
106-
VIRTUAL_THREAD_FIBERS: [virtual-thread-fibers, boolean, false, 'Use JDK 19+ VirtualThread for Fibers, also requires --vm.-enable-preview']
106+
VIRTUAL_THREAD_FIBERS: [virtual-thread-fibers, boolean, false, 'Use VirtualThread for Fibers']
107107
LOG_SUBPROCESS: [log-subprocess, boolean, false, 'Log whenever a subprocess is created'] # Also see --log-process-args
108108
WARN_LOCALE: [warn-locale, boolean, true, 'Warn when the system locale is not set properly']
109109

src/shared/java/org/truffleruby/shared/options/OptionsCatalog.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ public final class OptionsCatalog {
415415

416416
public static final OptionDescriptor VIRTUAL_THREAD_FIBERS = OptionDescriptor
417417
.newBuilder(VIRTUAL_THREAD_FIBERS_KEY, "ruby.virtual-thread-fibers")
418-
.help("Use JDK 19+ VirtualThread for Fibers, also requires --vm.-enable-preview")
418+
.help("Use VirtualThread for Fibers")
419419
.category(OptionCategory.EXPERT)
420420
.stability(OptionStability.EXPERIMENTAL)
421421
.usageSyntax("")

0 commit comments

Comments
 (0)