Repository navigation
Conversation
|
The presentation of thread features to a fiber is really tricky. The reason I have not made this change is because thread local variables do not stay with the parent thread, and are instead local to the fiber. So there's all sorts of nasty conflicts that I have not figure out how to resolve:
There's a number of conflicting goals here, and so far when I have tried to fix the current broken behavior (1 above), I always end up breaking something else (like 2 or 3 above). This trivial fix resolves 1, but breaks 2 and potentially 3 depending on how Thread.current is used. I'm afraid this is not enough :-( |
|
@headius thanks for the feedback. Sounds like it needs to be more explicit. |
|
@halorgium Sorry for the delay...but yes, it would be great if you could explore this more. I have not been able to find the magic sauce to mimic MRI behavior, since their behavior doesn't seem consistent with either threaded fibers OR lightweight fibers to me. |
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.
There is a bug which I am solving here.
I haven't added a rubyspec. Is this conceptually correct?