thread.c: put platform specific part in each impl file
This commit is contained in:
parent
bf1c4d254b
commit
d6d52a7d04
Notes:
git
2022-01-19 11:19:40 +09:00
19
thread.c
19
thread.c
@ -351,25 +351,6 @@ ubf_sigwait(void *ignore)
|
|||||||
|
|
||||||
#include THREAD_IMPL_SRC
|
#include THREAD_IMPL_SRC
|
||||||
|
|
||||||
#if defined(_WIN32)
|
|
||||||
|
|
||||||
#define DEBUG_OUT() \
|
|
||||||
WaitForSingleObject(&debug_mutex, INFINITE); \
|
|
||||||
printf(POSITION_FORMAT"%#lx - %s" POSITION_ARGS, GetCurrentThreadId(), buf); \
|
|
||||||
fflush(stdout); \
|
|
||||||
ReleaseMutex(&debug_mutex);
|
|
||||||
|
|
||||||
#elif defined(HAVE_PTHREAD_H)
|
|
||||||
|
|
||||||
#define DEBUG_OUT() \
|
|
||||||
pthread_mutex_lock(&debug_mutex); \
|
|
||||||
printf(POSITION_FORMAT"%"PRI_THREAD_ID" - %s" POSITION_ARGS, \
|
|
||||||
fill_thread_id_string(pthread_self(), thread_id_string), buf); \
|
|
||||||
fflush(stdout); \
|
|
||||||
pthread_mutex_unlock(&debug_mutex);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TODO: somebody with win32 knowledge should be able to get rid of
|
* TODO: somebody with win32 knowledge should be able to get rid of
|
||||||
* timer-thread by busy-waiting on signals. And it should be possible
|
* timer-thread by busy-waiting on signals. And it should be possible
|
||||||
|
@ -47,6 +47,13 @@
|
|||||||
# define USE_EVENTFD (0)
|
# define USE_EVENTFD (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define DEBUG_OUT() \
|
||||||
|
pthread_mutex_lock(&debug_mutex); \
|
||||||
|
printf(POSITION_FORMAT"%"PRI_THREAD_ID" - %s" POSITION_ARGS, \
|
||||||
|
fill_thread_id_string(pthread_self(), thread_id_string), buf); \
|
||||||
|
fflush(stdout); \
|
||||||
|
pthread_mutex_unlock(&debug_mutex);
|
||||||
|
|
||||||
#if defined(SIGVTALRM) && !defined(__CYGWIN__) && !defined(__EMSCRIPTEN__)
|
#if defined(SIGVTALRM) && !defined(__CYGWIN__) && !defined(__EMSCRIPTEN__)
|
||||||
# define USE_UBF_LIST 1
|
# define USE_UBF_LIST 1
|
||||||
#endif
|
#endif
|
||||||
|
@ -25,6 +25,12 @@
|
|||||||
#define ubf_timer_disarm() do {} while (0)
|
#define ubf_timer_disarm() do {} while (0)
|
||||||
#define ubf_list_atfork() do {} while (0)
|
#define ubf_list_atfork() do {} while (0)
|
||||||
|
|
||||||
|
#define DEBUG_OUT() \
|
||||||
|
WaitForSingleObject(&debug_mutex, INFINITE); \
|
||||||
|
printf(POSITION_FORMAT"%#lx - %s" POSITION_ARGS, GetCurrentThreadId(), buf); \
|
||||||
|
fflush(stdout); \
|
||||||
|
ReleaseMutex(&debug_mutex);
|
||||||
|
|
||||||
static volatile DWORD ruby_native_thread_key = TLS_OUT_OF_INDEXES;
|
static volatile DWORD ruby_native_thread_key = TLS_OUT_OF_INDEXES;
|
||||||
|
|
||||||
static int w32_wait_events(HANDLE *events, int count, DWORD timeout, rb_thread_t *th);
|
static int w32_wait_events(HANDLE *events, int count, DWORD timeout, rb_thread_t *th);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user