From: Yusuke Endoh Date: 2011-12-12T22:59:25+09:00 Subject: [ruby-core:41607] [ruby-trunk - Bug #5750][Rejected] Thread.current local-variables behavior Issue #5750 has been updated by Yusuke Endoh. Status changed from Open to Rejected Hello, thank you for your reporting. I am not surprised that you are surprised, but it is intentional. The rationale is because most of legacy libraries that uses thread- local storage will expect the storage to be also fiber-local. See also: http://redmine.ruby-lang.org/issues/show/1717 We cannot change this behavior until Ruby 3.0 (unless matz decides to change it). Thanks, -- Yusuke Endoh ---------------------------------------- Bug #5750: Thread.current local-variables behavior http://redmine.ruby-lang.org/issues/5750 Author: Julien A Status: Rejected Priority: Normal Assignee: Category: Target version: ruby -v: 1.9.3-p0 Hi, I stumbled upon something which for me is a bug and wanted to check if it is working as intended or not: Thread.current[:a] = 1 p Thread.current[:a] # => 1 Fiber.new do p Thread.current[:a] # => nil end.resume There is clearly a problem in either the documentation or the implementation for me there, we are in the same thread yet the returned values are different which is completely counter intuitive... Why not add a fiber-variables store to allow the following and keep things separated between fibers and threads Fiber.current[:a] = 1 p Fiber.current[:a] # => 1 Fiber.new do p Fiber.current[:a] # => nil end.resume Which is now the behavior I would expect. -- http://redmine.ruby-lang.org