Skip to content

Return Fiber's parent thread for Thread.current - #9621

Open
headius wants to merge 1 commit into
jruby:masterfrom
headius:fiber_current_thread
Open

headius wants to merge 1 commit into
jruby:masterfrom
headius:fiber_current_thread

Conversation

@headius

@headius headius commented Aug 31, 2026

Copy link
Copy Markdown
Member

A few step toward getting Thread.current in general to behave like CRuby, returning the same Thread for all Fiber instances that it owns.

Behind the scenes, each Fiber is still backed by a VirtualThread with an associated ThreadContext and RubyThread, but user code should generally not see those.

Additional fixes will follow for internal code that has expectations about the current thread of a fiber.

See other attempts to do this and issues related:

Relates to test failures mentioned in #9603 and workarounds from users in #9600.

A few step toward getting Thread.current in general to behave like
CRuby, returning the same Thread for all Fiber instances that it
owns.

Behind the scenes, each Fiber is still backed by a VirtualThread
with an associated ThreadContext and RubyThread, but user code
should generally not see those.

Additional fixes will follow for internal code that has
expectations about the current thread of a fiber.

See other attempts to do this and issues related:

* My attempt: jruby#5827
* Community attempt: jruby#1225
* An early issue: jruby#1806

Relates to test failures mentioned in jruby#9603 and
workarounds from users in jruby#9600.
@headius headius added this to the JRuby 10.1.x milestone Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant