From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id 7777B1F4B4 for ; Thu, 14 Jan 2021 03:41:14 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 9A589120A42; Thu, 14 Jan 2021 12:40:20 +0900 (JST) Received: from xtrwkhkc.outbound-mail.sendgrid.net (xtrwkhkc.outbound-mail.sendgrid.net [167.89.16.28]) by neon.ruby-lang.org (Postfix) with ESMTPS id A8E54120A2F for ; Thu, 14 Jan 2021 12:40:18 +0900 (JST) Received: by filterdrecv-p3iad2-577c7fd65d-8x9dl with SMTP id filterdrecv-p3iad2-577c7fd65d-8x9dl-19-5FFFBD51-30 2021-01-14 03:41:05.770634746 +0000 UTC m=+117748.558309709 Received: from herokuapp.com (unknown) by geopod-ismtpd-2-3 (SG) with ESMTP id RBJHu0o9QeyXjdK4t7IvCw for ; Thu, 14 Jan 2021 03:41:05.711 +0000 (UTC) Date: Thu, 14 Jan 2021 03:41:05 +0000 (UTC) From: daniel@dan42.com Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 77985 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Feature X-Redmine-Issue-Id: 12607 X-Redmine-Issue-Author: shyouhei X-Redmine-Issue-Assignee: ko1 X-Redmine-Sender: Dan0042 X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-SG-EID: =?us-ascii?Q?8sy4RigFvRTdBfCVJrT9zb2J88PC92TMQwdNgaWYaq4FTsUO+sBmFCKtJm5oFL?= =?us-ascii?Q?A690qvzI3eKyp9qxYUoYfVLm46GFEgeqoY8zepA?= =?us-ascii?Q?pz9fKS1hAe+LuEF+87=2Fu5D9GHu8XO8XobYhD0GZ?= =?us-ascii?Q?Cgnbj3b13O0xAlhDkSCswb6+MkQYn=2FYtcMWBnFD?= =?us-ascii?Q?Hfm3fAZRSAW8ah4nmgd+LjgFQ2tLpCFEojR7T9X?= =?us-ascii?Q?aRV9CZNvpRwlkJSVo=3D?= To: ruby-core@ruby-lang.org X-Entity-ID: b/2+PoftWZ6GuOu3b0IycA== X-ML-Name: ruby-core X-Mail-Count: 102082 Subject: [ruby-core:102082] [Ruby master Feature#12607] Ruby needs an atomic integer X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #12607 has been updated by Dan0042 (Daniel DeLorme). chrisseaton (Chris Seaton) wrote in #note-32: > An use-case I was working on earlier today was profiling operations like coverage and sampling tools. Ah yes, beautiful example! Accumulating metrics require both atomicity and performance. ---------------------------------------- Feature #12607: Ruby needs an atomic integer https://bugs.ruby-lang.org/issues/12607#change-89941 * Author: shyouhei (Shyouhei Urabe) * Status: Feedback * Priority: Normal * Assignee: ko1 (Koichi Sasada) ---------------------------------------- (This one was derived from bug #12463) Although I don't think += would become atomic, at the same time I understand Rodrigo's needs of _easier_ counter variable that resists inter-thread tampering. I don't think ruby's Integer class can be used for that purpose for reasons (mainly because it is not designed with threads in mind). Rather we should introduce a integer class which is carefully designed. Why not import Concurrent::AtomicFixnum into core? -- https://bugs.ruby-lang.org/