Skip to content

Commit 601930d

Browse files
committed
Set the thread current fiber in initializeThread()
1 parent ea27df1 commit 601930d

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/main/java/org/truffleruby/RubyLanguage.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -630,8 +630,9 @@ public void initializeThread(RubyContext context, Thread thread) {
630630
.shouldNotReachHere("Ruby threads should be initialized on their Java thread");
631631
}
632632
context.getThreadManager().start(rubyThread, thread);
633-
} else {
634-
// Fiber
633+
} else { // (non-root) Fiber
634+
var fiber = this.rubyFiber.get(thread);
635+
rubyThread.setCurrentFiber(fiber);
635636
}
636637
return;
637638
}

src/main/java/org/truffleruby/core/fiber/FiberManager.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,6 @@ private void beforeEnter(RubyFiber fiber, Node currentNode) {
136136
} catch (InterruptedException e) {
137137
throw CompilerDirectives.shouldNotReachHere("unexpected interrupt in Fiber beforeEnter()");
138138
}
139-
140-
// enter() polls so we need the current Fiber to be set before enter()
141-
fiber.rubyThread.setCurrentFiber(fiber);
142139
}
143140

144141
private void fiberMain(RubyContext context, RubyFiber fiber, RubyProc block, Node currentNode) {

0 commit comments

Comments
 (0)