@@ -29,6 +29,14 @@ static VALUE has_lock_in_call_without_gvl(VALUE self) {
29
29
return rb_thread_call_without_gvl (called_without_gvl , 0 , RUBY_UBF_IO , 0 );
30
30
}
31
31
32
+ static void * called_with_gvl (void * data ) {
33
+ return rb_tr_cext_lock_owned_p ();
34
+ }
35
+
36
+ static VALUE has_lock_in_call_with_gvl (VALUE self ) {
37
+ return rb_thread_call_with_gvl (called_with_gvl , 0 );
38
+ }
39
+
32
40
static VALUE has_lock_in_rb_funcall (VALUE self ) {
33
41
return rb_funcall (truffleCExt , rb_intern ("rb_tr_cext_lock_owned_p" ), 0 );
34
42
}
@@ -46,6 +54,7 @@ void Init_truffleruby_lock_spec(void) {
46
54
VALUE cls = rb_define_class ("CApiTruffleRubyLockSpecs" , rb_cObject );
47
55
rb_define_method (cls , "has_lock?" , has_lock , 0 );
48
56
rb_define_method (cls , "has_lock_in_call_without_gvl?" , has_lock_in_call_without_gvl , 0 );
57
+ rb_define_method (cls , "has_lock_in_call_with_gvl?" , has_lock_in_call_with_gvl , 0 );
49
58
rb_define_method (cls , "has_lock_in_rb_funcall?" , has_lock_in_rb_funcall , 0 );
50
59
51
60
rb_ext_ractor_safe (true);
0 commit comments