зеркало из https://github.com/github/ruby.git
Select including thread impl file at config time
This commit is contained in:
Родитель
ccda26efe7
Коммит
8590d61ea9
6
thread.c
6
thread.c
|
@ -349,8 +349,9 @@ ubf_sigwait(void *ignore)
|
|||
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)
|
|||
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)
|
|||
fflush(stdout); \
|
||||
pthread_mutex_unlock(&debug_mutex);
|
||||
|
||||
#else
|
||||
#error "unsupported thread type"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
|
@ -16,4 +16,13 @@ AS_CASE(["$THREAD_MODEL"],
|
|||
[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
|
||||
|
|
|
@ -80,11 +80,7 @@
|
|||
#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
|
||||
|
||||
|
|
|
@ -414,6 +414,8 @@ LIBRUBYARG_SHARED = $(LIBRUBY)
|
|||
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
|
|||
#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"
|
||||
|
|
Загрузка…
Ссылка в новой задаче