From: KOSAKI Motohiro Date: 2012-10-02T03:29:15+09:00 Subject: [ruby-core:47794] Re: [ruby-trunk - Bug #7097][Assigned] Thread locals don't work inside Enumerator On Mon, Oct 1, 2012 at 2:24 PM, KOSAKI Motohiro wrote: > On Mon, Oct 1, 2012 at 2:12 PM, Aaron Patterson > wrote: >> On Tue, Oct 02, 2012 at 03:05:17AM +0900, kosaki (Motohiro KOSAKI) wrote: >>> >>> Issue #7097 has been updated by kosaki (Motohiro KOSAKI). >>> >>> Status changed from Open to Assigned >>> Assignee set to ko1 (Koichi Sasada) >>> >>> 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. > > Thread local variable is pretty misleading name. In fact, ruby only have > a fiber local variable. i.e. Thread.current[:foo] is to write fiber > local variable. > > Using 'Thread' class is a just historical reason, IMHO. (and I completely agree > it's pretty misleading) see also: http://bugs.ruby-lang.org/issues/1717 http://bugs.ruby-lang.org/issues/5750