From: SASADA Koichi <ko1@...>
Date: 2012-10-02T08:22:01+09:00
Subject: [ruby-core:47798] Re: [ruby-trunk - Bug #7097][Assigned] Thread locals don't work inside Enumerator

(2012/10/02 3:12), Aaron Patterson wrote:
>> > I guess it's a side effect to use Fiber in Enumerator internal.
> Yes, it is.  I don't know why Fibers impact thread locals, but I hope
> this test demonstrates how it can cause problems.

Enumerator uses Fiber to keep a control flow in internal.

Now thread local variables are fiber locals.  I agree it is confusing.
But I'm not sure how to solve it.

One idea is:

  - Define: Thread#[] -> Thred#current_fiber#[]
  - Add: Thread#truly_thread_local_get(key)
    and  Thread#truly_thread_local_set(key, val)

(of course, truly_... is temporal name)

-- 
// SASADA Koichi at atdot dot net