From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: poffice@blade.nagaokaut.ac.jp Delivered-To: poffice@blade.nagaokaut.ac.jp Received: from kankan.nagaokaut.ac.jp (kankan.nagaokaut.ac.jp [133.44.2.24]) by blade.nagaokaut.ac.jp (Postfix) with ESMTP id D721917CEB45 for ; Thu, 4 Apr 2013 22:13:20 +0900 (JST) Received: from funfun.nagaokaut.ac.jp (smtp.nagaokaut.ac.jp [133.44.2.201]) by kankan.nagaokaut.ac.jp (Postfix) with ESMTP id E93F0EA6D64 for ; Thu, 4 Apr 2013 21:50:40 +0900 (JST) Received: from funfun.nagaokaut.ac.jp (localhost.nagaokaut.ac.jp [127.0.0.1]) by funfun.nagaokaut.ac.jp (Postfix) with ESMTP id 003DE97A826 for ; Thu, 4 Apr 2013 21:50:41 +0900 (JST) X-Virus-Scanned: amavisd-new at nagaokaut.ac.jp Received: from funfun.nagaokaut.ac.jp ([127.0.0.1]) by funfun.nagaokaut.ac.jp (funfun.nagaokaut.ac.jp [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HNhcaNtisTIs for ; Thu, 4 Apr 2013 21:50:40 +0900 (JST) Received: from voscc.nagaokaut.ac.jp (voscc.nagaokaut.ac.jp [133.44.1.100]) by funfun.nagaokaut.ac.jp (Postfix) with ESMTP id D322F97A820 for ; Thu, 4 Apr 2013 21:50:40 +0900 (JST) Received: from carbon.ruby-lang.org (carbon.ruby-lang.org [221.186.184.68]) by voscc.nagaokaut.ac.jp (Postfix) with ESMTP id 1639895242E for ; Thu, 4 Apr 2013 21:50:37 +0900 (JST) Received: from beryllium.ruby-lang.org (beryllium.ruby-lang.org [127.0.0.1]) by carbon.ruby-lang.org (Postfix) with ESMTP id D36C93C2294C2; Thu, 4 Apr 2013 21:50:35 +0900 (JST) Received: from fluorine.ruby-lang.org (www.rubyist.net [210.251.121.216]) by carbon.ruby-lang.org (Postfix) with ESMTP id 5C9D53C21ED76 for ; Thu, 4 Apr 2013 21:50:35 +0900 (JST) Received: from ruby-lang.org (localhost [127.0.0.1]) by fluorine.ruby-lang.org (Postfix) with ESMTP id 4CB7D3ED21 for ; Thu, 4 Apr 2013 21:50:35 +0900 (JST) Delivered-To: ruby-core@ruby-lang.org Date: Thu, 4 Apr 2013 21:50:35 +0900 Posted: Thu, 4 Apr 2013 21:50:35 +0900 From: "Eregon (Benoit Daloze)" Reply-To: ruby-core@ruby-lang.org Subject: [ruby-core:53990] [ruby-trunk - Feature #8215][Closed] Support accessing Fiber-locals and backtraces for a Fiber To: ruby-core@ruby-lang.org Message-Id: References: X-ML-Name: ruby-core X-Mail-Count: 53990 X-MLServer: fml [fml 4.0.3 release (20011202/4.0.3)]; post only (only members can post) X-ML-Info: If you have a question, send e-mail with the body "help" (without quotes) to the address ruby-core-ctl@ruby-lang.org; help= X-Mailer: Redmine X-Redmine-Issue-Author: halorgium X-Auto-Response-Suppress: OOF X-Redmine-Issue-Id: 8215 X-Redmine-Mailinglistintegration-Message-Ids: 27163 X-Redmine-Project: ruby-trunk Auto-Submitted: auto-generated X-Redmine-Site: Ruby Issue Tracking System X-Redmine-Host: bugs.ruby-lang.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Precedence: bulk List-Id: ruby-core.ruby-lang.org List-Software: fml [fml 4.0.3 release (20011202/4.0.3)] List-Post: List-Owner: List-Help: List-Unsubscribe: Issue #8215 has been updated by Eregon (Benoit Daloze). Category set to core Status changed from Open to Closed Thread#[] and friends access *Fiber*-local variables, as the doc says: (Attribute Reference---Returns the value of a fiber-local variable (current thread's root fiber if not explicitely inside a Fiber), using either a symbol or a string name.) This is unfortunate, as indeed one might expect it to be *thread*-local, but it has been made fiber-local for safety. In ruby >= 2.0.0, you have thread_variable_{get,set} and such for manipulating *thread*-local variables. Not as nice, but at least the API is there. See #7097. ---------------------------------------- Feature #8215: Support accessing Fiber-locals and backtraces for a Fiber https://bugs.ruby-lang.org/issues/8215#change-38215 Author: halorgium (Tim Carey-Smith) Status: Closed Priority: Normal Assignee: Category: core Target version: As part of debugging celluloid, I have been wanting to diagnose where the Fibers are running and their various locals. I would expect the following to work. Thread.current[:key] = "outside" fiber = Fiber.new do Thread.current[:key] = "inside" Fiber.yield end fiber.resume fiber[:key] == "inside" # true fiber.backtrace # ... I also wonder whether Fiber#[] should be implemented, so Fiber.current[:key] is possible. For reference, here is the issue on the rubinius issue tracker: https://github.com/rubinius/rubinius/issues/2200 -- http://bugs.ruby-lang.org/