summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Williams <[email protected]>2024-11-21 10:38:13 +1300
committerSamuel Williams <[email protected]>2025-04-14 18:28:09 +0900
commit4e970c5d5aee94c729541236c69792ec314f3731 ()
tree298baeb38bbc456e9615b7656f4aa0d5b304a6bf
parent22667fcc38f6246f8d93f229097375f85e3efbab (diff)
Expose `ruby_thread_has_gvl_p`.
Notes: Merged: https://.com/ruby/ruby/pull/11975
-rw-r--r--include/ruby/thread.h7
-rw-r--r--spec/ruby/optional/capi/ext/thread_spec.c10
-rw-r--r--spec/ruby/optional/capi/thread_spec.rb8
-rw-r--r--thread.c5
4 files changed, 24 insertions, 6 deletions
@@ -333,6 +333,13 @@ void *rb_internal_thread_specific_get(VALUE thread_val, rb_internal_thread_speci
*/
void rb_internal_thread_specific_set(VALUE thread_val, rb_internal_thread_specific_key_t key, void *data);
RBIMPL_SYMBOL_EXPORT_END()
#endif /* RUBY_THREAD_H */
@@ -118,7 +118,6 @@ static VALUE thread_spec_rb_thread_wait_for(VALUE self, VALUE s, VALUE ms) {
return Qnil;
}
-
VALUE thread_spec_call_proc(void *arg_ptr) {
VALUE arg_array = (VALUE)arg_ptr;
VALUE arg = rb_ary_pop(arg_array);
@@ -167,6 +166,12 @@ static VALUE thread_spec_ruby_native_thread_p_new_thread(VALUE self) {
#endif
}
void Init_thread_spec(void) {
VALUE cls = rb_define_class("CApiThreadSpecs", rb_cObject);
rb_define_method(cls, "rb_thread_alone", thread_spec_rb_thread_alone, 0);
@@ -180,6 +185,9 @@ void Init_thread_spec(void) {
rb_define_method(cls, "rb_thread_create", thread_spec_rb_thread_create, 2);
rb_define_method(cls, "ruby_native_thread_p", thread_spec_ruby_native_thread_p, 0);
rb_define_method(cls, "ruby_native_thread_p_new_thread", thread_spec_ruby_native_thread_p_new_thread, 0);
}
#ifdef __cplusplus
@@ -184,4 +184,12 @@ describe "C-API Thread function" do
thr.value.should be_true
end
end
end
@@ -1937,11 +1937,6 @@ rb_thread_call_with_gvl(void *(*func)(void *), void *data1)
/*
* ruby_thread_has_gvl_p - check if current native thread has GVL.
- *
- ***
- *** This API is EXPERIMENTAL!
- *** We do not guarantee that this API remains in ruby 1.9.2 or later.
- ***
*/
int