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/