ruby-changes:69532
From: Yuta <ko1@a...>
Date: Sat, 30 Oct 2021 10:18:44 +0900 (JST)
Subject: [ruby-changes:69532] 8590d61ea9 (master): Select including thread impl file at config time
https://git.ruby-lang.org/ruby.git/commit/?id=8590d61ea9 From 8590d61ea9b6b91c89a14a8d0f6829c8a3a8c6c8 Mon Sep 17 00:00:00 2001 From: Yuta Saito <kateinoigakukun@g...> Date: Thu, 28 Oct 2021 15:51:40 +0900 Subject: Select including thread impl file at config time --- thread.c | 6 ++---- tool/m4/ruby_thread.m4 | 9 +++++++++ vm_core.h | 6 +----- win32/Makefile.sub | 4 ++++ 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/thread.c b/thread.c index 1209de948ad..0e3b53ae0b6 100644 --- a/thread.c +++ b/thread.c @@ -349,8 +349,9 @@ ubf_sigwait(void *ignore) https://github.com/ruby/ruby/blob/trunk/thread.c#L349 rb_thread_wakeup_timer_thread(0); } +#include THREAD_IMPL_SRC + #if defined(_WIN32) -#include "thread_win32.c" #define DEBUG_OUT() \ WaitForSingleObject(&debug_mutex, INFINITE); \ @@ -359,7 +360,6 @@ ubf_sigwait(void *ignore) https://github.com/ruby/ruby/blob/trunk/thread.c#L360 ReleaseMutex(&debug_mutex); #elif defined(HAVE_PTHREAD_H) -#include "thread_pthread.c" #define DEBUG_OUT() \ pthread_mutex_lock(&debug_mutex); \ @@ -368,8 +368,6 @@ ubf_sigwait(void *ignore) https://github.com/ruby/ruby/blob/trunk/thread.c#L368 fflush(stdout); \ pthread_mutex_unlock(&debug_mutex); -#else -#error "unsupported thread type" #endif /* diff --git a/tool/m4/ruby_thread.m4 b/tool/m4/ruby_thread.m4 index 92d80421f14..6f1e3960b16 100644 --- a/tool/m4/ruby_thread.m4 +++ b/tool/m4/ruby_thread.m4 @@ -16,4 +16,13 @@ AS_CASE(["$THREAD_MODEL"], https://github.com/ruby/ruby/blob/trunk/tool/m4/ruby_thread.m4#L16 [win32], [], [""], [AC_MSG_ERROR(thread model is missing)], [AC_MSG_ERROR(unknown thread model $THREAD_MODEL)]) + +THREAD_IMPL_H=thread_$THREAD_MODEL.h +AS_IF([test ! -f "$srcdir/$THREAD_IMPL_H"], + [AC_MSG_ERROR('$srcdir/$THREAD_IMPL_H' must exist)]) +THREAD_IMPL_SRC=thread_$THREAD_MODEL.c +AS_IF([test ! -f "$srcdir/$THREAD_IMPL_SRC"], + [AC_MSG_ERROR('$srcdir/$THREAD_IMPL_SRC' must exist)]) +AC_DEFINE_UNQUOTED(THREAD_IMPL_H, ["$THREAD_IMPL_H"]) +AC_DEFINE_UNQUOTED(THREAD_IMPL_SRC, ["$THREAD_IMPL_SRC"]) ])dnl diff --git a/vm_core.h b/vm_core.h index 96437ff5599..2e022a6dd01 100644 --- a/vm_core.h +++ b/vm_core.h @@ -80,11 +80,7 @@ https://github.com/ruby/ruby/blob/trunk/vm_core.h#L80 #include "darray.h" #include "ruby/thread_native.h" -#if defined(_WIN32) -#include "thread_win32.h" -#elif defined(HAVE_PTHREAD_H) -#include "thread_pthread.h" -#endif +#include THREAD_IMPL_H #define RUBY_VM_THREAD_MODEL 2 diff --git a/win32/Makefile.sub b/win32/Makefile.sub index 2aef63985b1..ce8cafe8075 100644 --- a/win32/Makefile.sub +++ b/win32/Makefile.sub @@ -414,6 +414,8 @@ LIBRUBYARG_SHARED = $(LIBRUBY) https://github.com/ruby/ruby/blob/trunk/win32/Makefile.sub#L414 LIBRUBY_RELATIVE = yes THREAD_MODEL = win32 +THREAD_IMPL_H = thread_$(THREAD_MODEL).h +THREAD_IMPL_SRC = thread_$(THREAD_MODEL).c !if "$(CROSS_COMPILING)" == "yes" PREP = $(arch)-fake.rb @@ -873,6 +875,8 @@ $(CONFIG_H): $(MKFILES) $(srcdir)/win32/Makefile.sub $(win_srcdir)/Makefile.sub https://github.com/ruby/ruby/blob/trunk/win32/Makefile.sub#L875 #define STACK_GROW_DIRECTION -1 !endif #define COROUTINE_H "$(COROUTINE_H)" +#define THREAD_IMPL_H "$(THREAD_IMPL_H)" +#define THREAD_IMPL_SRC "$(THREAD_IMPL_SRC)" #define LOAD_RELATIVE 1 #define DLEXT ".so" !if "$(libdir_basename)" != "lib" -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/