aboutsummaryrefslogtreecommitdiffstats
path: root/spec/ruby/optional/capi/ext/thread_spec.c
diff options
context:
space:
mode:
authoreregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-01-20 20:38:57 +0000
committereregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-01-20 20:38:57 +0000
commit6204e0804b24f1675b49d5880da014411bcfb831 (patch)
treece6c00bf078fc416936ca3cdc972b9b3c1c78dae /spec/ruby/optional/capi/ext/thread_spec.c
parent58573c33e4720315ed27491e31dcc22892e1ce95 (diff)
downloadruby-6204e0804b24f1675b49d5880da014411bcfb831.tar.gz
Update to ruby/spec@35a9fba
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66888 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/ruby/optional/capi/ext/thread_spec.c')
-rw-r--r--spec/ruby/optional/capi/ext/thread_spec.c45
1 files changed, 2 insertions, 43 deletions
diff --git a/spec/ruby/optional/capi/ext/thread_spec.c b/spec/ruby/optional/capi/ext/thread_spec.c
index fed1b1f3b0..b10d557dd5 100644
--- a/spec/ruby/optional/capi/ext/thread_spec.c
+++ b/spec/ruby/optional/capi/ext/thread_spec.c
@@ -4,7 +4,7 @@
#include <math.h>
#include <errno.h>
-#if HAVE_UNISTD_H
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#if defined(_WIN32)
@@ -15,15 +15,12 @@
extern "C" {
#endif
-#ifdef HAVE_RB_THREAD_ALONE
static VALUE thread_spec_rb_thread_alone() {
return rb_thread_alone() ? Qtrue : Qfalse;
}
-#endif
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#ifdef HAVE_RB_THREAD_CALL_WITHOUT_GVL
/* This is unblocked by unblock_func(). */
static void* blocking_gvl_func(void* data) {
int rfd = *(int *)data;
@@ -91,33 +88,23 @@ static VALUE thread_spec_rb_thread_call_without_gvl_with_ubf_io(VALUE self) {
close(fds[1]);
return (VALUE)ret;
}
-#endif
-#ifdef HAVE_RB_THREAD_CURRENT
static VALUE thread_spec_rb_thread_current() {
return rb_thread_current();
}
-#endif
-#ifdef HAVE_RB_THREAD_LOCAL_AREF
static VALUE thread_spec_rb_thread_local_aref(VALUE self, VALUE thr, VALUE sym) {
return rb_thread_local_aref(thr, SYM2ID(sym));
}
-#endif
-#ifdef HAVE_RB_THREAD_LOCAL_ASET
static VALUE thread_spec_rb_thread_local_aset(VALUE self, VALUE thr, VALUE sym, VALUE value) {
return rb_thread_local_aset(thr, SYM2ID(sym), value);
}
-#endif
-#ifdef HAVE_RB_THREAD_WAKEUP
static VALUE thread_spec_rb_thread_wakeup(VALUE self, VALUE thr) {
return rb_thread_wakeup(thr);
}
-#endif
-#ifdef HAVE_RB_THREAD_WAIT_FOR
static VALUE thread_spec_rb_thread_wait_for(VALUE self, VALUE s, VALUE ms) {
struct timeval tv;
tv.tv_sec = NUM2INT(s);
@@ -125,9 +112,7 @@ static VALUE thread_spec_rb_thread_wait_for(VALUE self, VALUE s, VALUE ms) {
rb_thread_wait_for(tv);
return Qnil;
}
-#endif
-#ifdef HAVE_RB_THREAD_CREATE
VALUE thread_spec_call_proc(VALUE arg_array) {
VALUE arg = rb_ary_pop(arg_array);
@@ -142,45 +127,19 @@ static VALUE thread_spec_rb_thread_create(VALUE self, VALUE proc, VALUE arg) {
return rb_thread_create(thread_spec_call_proc, (void*)args);
}
-#endif
void Init_thread_spec(void) {
- VALUE cls;
- cls = rb_define_class("CApiThreadSpecs", rb_cObject);
-
-#ifdef HAVE_RB_THREAD_ALONE
+ VALUE cls = rb_define_class("CApiThreadSpecs", rb_cObject);
rb_define_method(cls, "rb_thread_alone", thread_spec_rb_thread_alone, 0);
-#endif
-
-#ifdef HAVE_RB_THREAD_CALL_WITHOUT_GVL
rb_define_method(cls, "rb_thread_call_without_gvl", thread_spec_rb_thread_call_without_gvl, 0);
rb_define_method(cls, "rb_thread_call_without_gvl_with_ubf_io", thread_spec_rb_thread_call_without_gvl_with_ubf_io, 0);
-#endif
-
-#ifdef HAVE_RB_THREAD_CURRENT
rb_define_method(cls, "rb_thread_current", thread_spec_rb_thread_current, 0);
-#endif
-
-#ifdef HAVE_RB_THREAD_LOCAL_AREF
rb_define_method(cls, "rb_thread_local_aref", thread_spec_rb_thread_local_aref, 2);
-#endif
-
-#ifdef HAVE_RB_THREAD_LOCAL_ASET
rb_define_method(cls, "rb_thread_local_aset", thread_spec_rb_thread_local_aset, 3);
-#endif
-
-#ifdef HAVE_RB_THREAD_WAKEUP
rb_define_method(cls, "rb_thread_wakeup", thread_spec_rb_thread_wakeup, 1);
-#endif
-
-#ifdef HAVE_RB_THREAD_WAIT_FOR
rb_define_method(cls, "rb_thread_wait_for", thread_spec_rb_thread_wait_for, 2);
-#endif
-
-#ifdef HAVE_RB_THREAD_CREATE
rb_define_method(cls, "rb_thread_create", thread_spec_rb_thread_create, 2);
-#endif
}
#ifdef __cplusplus