From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on starla X-Spam-Level: X-Spam-Status: No, score=0.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_BL_SPAMCOP_NET,SPF_HELO_PASS, SPF_PASS autolearn=no autolearn_force=no version=3.4.6 Received: from nue.mailmanlists.eu (nue.mailmanlists.eu [94.130.110.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 56AE11F5CB for ; Thu, 19 Sep 2024 16:39:55 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (1024-bit key; unprotected) header.d=ml.ruby-lang.org header.i=@ml.ruby-lang.org header.a=rsa-sha256 header.s=mail header.b=2oWkeL92; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ruby-lang.org header.i=@ruby-lang.org header.a=rsa-sha256 header.s=s1 header.b=VIwjuDa5; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ml.ruby-lang.org; s=mail; t=1726763992; bh=7awYX4X+vV8mBmyVRiTg01V4L4YIIwK2ewdCJMGsqu4=; h=Date:References:To:Reply-To:Subject:List-Id:List-Archive: List-Help:List-Owner:List-Post:List-Subscribe:List-Unsubscribe: From:Cc:From; b=2oWkeL92hDShvPP2O3Ni1iWdAD57Z22dDscLx9WgC7OllzGvO4aesYXqjdeBx3GhO 88Lm6zpfWOHLcC3o0j+ZVfEX2uIUk/YKJ4jZs+e6vWfNpJ51L7rCb2apc4fICpoxRi Y8JAgxPdXYFtFgyUzrUKEKOViIvNMM00e2xB29Uk= Received: from nue.mailmanlists.eu (localhost [IPv6:::1]) by nue.mailmanlists.eu (Postfix) with ESMTP id A9F7243E22 for ; Thu, 19 Sep 2024 16:39:52 +0000 (UTC) Authentication-Results: nue.mailmanlists.eu; dkim=pass (2048-bit key; unprotected) header.d=ruby-lang.org header.i=@ruby-lang.org header.a=rsa-sha256 header.s=s1 header.b=VIwjuDa5; dkim-atps=neutral Received: from s.wrqvtvvn.outbound-mail.sendgrid.net (s.wrqvtvvn.outbound-mail.sendgrid.net [149.72.120.130]) by nue.mailmanlists.eu (Postfix) with ESMTPS id F3C7043DC8 for ; Thu, 19 Sep 2024 16:39:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ruby-lang.org; h=from:references:subject:mime-version:content-type: content-transfer-encoding:list-id:to:cc:content-type:from:subject:to; s=s1; bh=sV5iL0Z++0O3gP5T7tfEF9ucrqJknhE50TmKxR/8A5M=; b=VIwjuDa5HLZOXcdLlX3TK5dDCBBcZZuKJE4HyA8d+vGVEKOeJnj46+T17dQYWr8pWcOl KL2wWLnStbcQiJshvJP3BP19zVPB7+P5eAfv78FVono6pKINNeq0gDuKo+OHUMxiIoXAdm EGti+fQuZalVLPMVoa5i74m3rIviZVHTBB0xxeQ2Dm9N+0dxiy0sBpPisw4dNHvVtHPrNc 7Du5gjW+9YwcHkm1XBXYRwzSeH4LdDblF45LDS9mYx14RwOEh0MvKH4/VQShuz/4+smZ5/ GCKA+byE7AwZM5ni6Xgz/UFd7EDEKVs8+VxJdb6voeSNFHEIP3/ozZeE2I4o6HSA== Received: by recvd-7cc7f7d978-b25b7 with SMTP id recvd-7cc7f7d978-b25b7-1-66EC53CB-30 2024-09-19 16:39:39.816674818 +0000 UTC m=+600075.118533565 Received: from herokuapp.com (unknown) by geopod-ismtpd-18 (SG) with ESMTP id fdwavK8ASJqe4NIMftR0xw for ; Thu, 19 Sep 2024 16:39:39.792 +0000 (UTC) Date: Thu, 19 Sep 2024 16:39:39 +0000 (UTC) Message-ID: References: Mime-Version: 1.0 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Feature X-Redmine-Issue-Id: 20750 X-Redmine-Issue-Author: kbrock X-Redmine-Issue-Priority: Normal X-Redmine-Sender: kbrock 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-Redmine-MailingListIntegration-Message-Ids: 95896 X-SG-EID: =?us-ascii?Q?u001=2E+Y2T8K9iEYAG22L5MkNQC34RaZgdxGaDq8I6aaeV+81e=2FcAwba8i7Lr6l?= =?us-ascii?Q?JBfIB15Ky15z3kpZdwvEgeU0vcG8GRvA1yRzuSG?= =?us-ascii?Q?gLHjtwhUAef2C7uFPxl71olCNmG59YwfdT=2FjToz?= =?us-ascii?Q?ZZHHryjAcVUVnjLubT99xXKdLeXFeN4hXvz4q3w?= =?us-ascii?Q?FSD7L5nupMoyx2Y=2FrHbJIH5ZLwgjXYTWtOud+xN?= =?us-ascii?Q?cY2+ijG2itmRA3HEJJVVuSAXCx+VbcHdvumgENf?= =?us-ascii?Q?8jkLcb6qu9Yq7lucQ207C6EZsQ=3D=3D?= To: ruby-core@ml.ruby-lang.org X-Entity-ID: u001.I8uzylDtAfgbeCOeLBYDww== Message-ID-Hash: KTXUW45SZ4AKTWU3TVRG6KCI4MAD5DEV X-Message-ID-Hash: KTXUW45SZ4AKTWU3TVRG6KCI4MAD5DEV X-MailFrom: bounces+313651-b711-ruby-core=ml.ruby-lang.org@em5188.ruby-lang.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list Reply-To: Ruby developers Subject: [ruby-core:119261] [Ruby master Feature#20750] Expose ruby_thread_has_gvl_p in ruby/thread.h List-Id: Ruby developers Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: "kbrock (Keenan Brock) via ruby-core" Cc: "kbrock (Keenan Brock)" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Issue #20750 has been updated by kbrock (Keenan Brock). File 0001-rb_thread_call_with_gvl-is-lenient-when-it-has-alrea.patch added File 0002-Don-t-check-GVL-before-calling-into-with_gvl_callbac.patch added Hello, Here is the new proposed patch for your review. https://github.com/ruby/ruby/pull/11649 I do not know if we try and keep changes as small as possible (to avoid introducing bugs) Or if we refactor along the way. ---------------------------------------- Feature #20750: Expose ruby_thread_has_gvl_p in ruby/thread.h https://bugs.ruby-lang.org/issues/20750#change-109850 * Author: kbrock (Keenan Brock) * Status: Open ---------------------------------------- Hello All, I'm hoping we can make `ruby_thread_has_gvl_p` a public method and no longer experimental. I saw the following code in a gem that was not compiling with ruby 3.3: ``` c // int ruby_thread_has_gvl_p(void); // <== line of concern if (ruby_thread_has_gvl_p()) { method_call(&context); } else { rb_thread_call_with_gvl(method_call, &context); } ``` 400 unique projects on github added the line listed above to fix compilation. [1] Some of the projects detected the method first in `extconf.rb`, but a majority just referenced it. `ffi` used to have the detection code but dropped it since the method was in all supported ruby versions. It feels like this method is now part of the undocumented public interface. My suggestion is to add the method to the real public interface in `ruby/thread.h`. PR with possible solution: https://github.com/ruby/ruby/pull/11619 Also included a patch if that is easier Thank you for your consideration, Keenan Timeline: - Dec 30 2008 - `rb_thread_call_with_gvl` introduced via 9c04a06 [2] - Jan 12 2009 - `ruby_thread_has_gvl_p` introduced via 6f09fc2 [4] - Jul 18 2012 - `rb_thread_call_with_gvl` made public via e9a91d2 [3] Current references to code: `rb_thread_call_with_gvl` [5] `ruby_thread_has_gvl_p` [6]: [1]: https://github.com/search?q=ruby_thread_has_gvl_p+language%3AC++NOT+is%3Afork++NOT+is%3Aarchived&type=code [2]: https://github.com/ruby/ruby/commit/9c04a0647fb99f7554cb2e04385ddbb970631e02 [3]: https://github.com/ruby/ruby/commit/e9a91d2c95dfe22ad0487952f7a1053ef9a5fd16 [4]: https://github.com/ruby/ruby/commit/6f09fc2efd1915c4337ce6dded52a8a8771c3222 [5]: https://github.com/ruby/ruby/blob/master/thread.c#L1878 [6]: https://github.com/ruby/ruby/blob/master/thread.c#L1923 ---Files-------------------------------- 11618.patch (3.18 KB) 0001-rb_thread_call_with_gvl-is-lenient-when-it-has-alrea.patch (1.26 KB) 0002-Don-t-check-GVL-before-calling-into-with_gvl_callbac.patch (2.91 KB) -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/