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 5BEA019C0028 for ; Wed, 21 Oct 2015 07:02:13 +0900 (JST) Received: from voscc.nagaokaut.ac.jp (voscc.nagaokaut.ac.jp [133.44.1.100]) by kankan.nagaokaut.ac.jp (Postfix) with ESMTP id AC9E2B5D8EE for ; Wed, 21 Oct 2015 07:29:10 +0900 (JST) Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by voscc.nagaokaut.ac.jp (Postfix) with ESMTP id 82E18952447 for ; Wed, 21 Oct 2015 07:28:59 +0900 (JST) Received: from [221.186.184.76] (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 0D1AC120499; Wed, 21 Oct 2015 07:28:58 +0900 (JST) X-Original-To: ruby-core@ruby-lang.org Delivered-To: ruby-core@ruby-lang.org Received: from o10.shared.sendgrid.net (o10.shared.sendgrid.net [173.193.132.135]) by neon.ruby-lang.org (Postfix) with ESMTPS id A72A912045E for ; Wed, 21 Oct 2015 07:28:34 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sendgrid.me; h=from:to:references:subject:mime-version:content-type:content-transfer-encoding:list-id; s=smtpapi; bh=D+GQ76h3HNf0z/J05aGQoe4uUxM=; b=tFCXAT+ie3CHoSkdB+ xEDotglO7QdednuFb2gYkbrFjT5tfgJ5C803upO8ZTXW0FEzoM/iFCRenKr73/tm UOg6EZ8PThl57vgwUOggaQPmTQbRd/BMRQC0jtN51sjpMYu05o/opX33sNg/g/mI CZIzcpSaWlDHY7oYQrH33Bvj8= Received: by filter0570p1mdw1.sendgrid.net with SMTP id filter0570p1mdw1.12478.5626C00C22 2015-10-20 22:28:28.402862681 +0000 UTC Received: from herokuapp.com (ec2-54-158-116-103.compute-1.amazonaws.com [54.158.116.103]) by ismtpd0004p1iad1.sendgrid.net (SG) with ESMTP id 3EndavR-T02HjjQ2SkRLzw Tue, 20 Oct 2015 22:28:28.397 +0000 (UTC) Date: Tue, 20 Oct 2015 22:28:28 +0000 From: normalperson@yhbt.net To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Redmine-MailingListIntegration-Message-Ids: 45755 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 11607 X-Redmine-Issue-Author: normalperson X-Redmine-Issue-Assignee: tenderlovemaking X-Redmine-Sender: normalperson 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: ync6xU2WACa70kv/Ymy4QrNMhiuLXJG8OTL2vJD1yS5+/okTudnmmJ0E4EHwtLqA7bmZb9WEkavThV CZ6HlVeJ2G9E/TeXXV3TYYDjoI95Dlo8COvt7JGv28FWtMYmlk+SgrKr/uD2gSjxp+AoN5PQRe7Zeg Y24ky4IHYuoJEkU6g4CWyLxs16ndAmhb6D2P X-ML-Name: ruby-core X-Mail-Count: 71127 Subject: [ruby-core:71127] [Ruby trunk - Feature #11607] [PATCH] fiddle: release GVL for ffi_call 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: , Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #11607 has been updated by Eric Wong. File fiddle-release-GVL-for-ffi_call-v2.patch added v2 fixes a warning I did not notice before, interdiff: ~~~ --- a/ext/fiddle/closure.c +++ b/ext/fiddle/closure.c @@ -64,7 +64,7 @@ struct callback_args { void *ctx; }; -static void +static void * with_gvl_callback(void *ptr) { struct callback_args *x = ptr; @@ -177,6 +177,7 @@ with_gvl_callback(void *ptr) default: rb_raise(rb_eRuntimeError, "closure retval: %d", type); } + return 0; } static void ~~~ ---------------------------------------- Feature #11607: [PATCH] fiddle: release GVL for ffi_call https://bugs.ruby-lang.org/issues/11607#change-54498 * Author: Eric Wong * Status: Open * Priority: Normal * Assignee: Aaron Patterson ---------------------------------------- Some external functions I wish to call may take a long time and unnecessarily block other threads. This may lead to performance regressions for fast functions as releasing/acquiring the GVL is not cheap, but can improve performance for long-running functions in multi-threaded applications. This also means we must reacquire the GVL when calling Ruby-defined callbacks for Fiddle::Closure, meaning we must detect whether the current thread has the GVL by exporting ruby_thread_has_gvl_p in internal.h ---Files-------------------------------- 0001-fiddle-release-GVL-for-ffi_call.patch (11.3 KB) fiddle-release-GVL-for-ffi_call-v2.patch (11.2 KB) -- https://bugs.ruby-lang.org/