[前][次][番号順一覧][スレッド一覧]

ruby-changes:70948

From: Yuta <ko1@a...>
Date: Wed, 19 Jan 2022 11:19:52 +0900 (JST)
Subject: [ruby-changes:70948] d6d52a7d04 (master): thread.c: put platform specific part in each impl file

https://git.ruby-lang.org/ruby.git/commit/?id=d6d52a7d04

From d6d52a7d049fd802b37d0f594629bad2cdc6b8c2 Mon Sep 17 00:00:00 2001
From: Yuta Saito <kateinoigakukun@g...>
Date: Sun, 16 Jan 2022 00:37:09 +0900
Subject: thread.c: put platform specific part in each impl file

---
 thread.c         | 19 -------------------
 thread_pthread.c |  7 +++++++
 thread_win32.c   |  6 ++++++
 3 files changed, 13 insertions(+), 19 deletions(-)

diff --git a/thread.c b/thread.c
index 7b4ed2a7abb..52ecf124bd7 100644
--- a/thread.c
+++ b/thread.c
@@ -351,25 +351,6 @@ ubf_sigwait(void *ignore) https://github.com/ruby/ruby/blob/trunk/thread.c#L351
 
 #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
  * timer-thread by busy-waiting on signals.  And it should be possible
diff --git a/thread_pthread.c b/thread_pthread.c
index 6f0cc3d54c5..55289de73a3 100644
--- a/thread_pthread.c
+++ b/thread_pthread.c
@@ -47,6 +47,13 @@ https://github.com/ruby/ruby/blob/trunk/thread_pthread.c#L47
 #  define USE_EVENTFD (0)
 #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__)
 #  define USE_UBF_LIST 1
 #endif
diff --git a/thread_win32.c b/thread_win32.c
index 026ccc4c600..9b44ceb96a9 100644
--- a/thread_win32.c
+++ b/thread_win32.c
@@ -25,6 +25,12 @@ https://github.com/ruby/ruby/blob/trunk/thread_win32.c#L25
 #define ubf_timer_disarm() 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 int w32_wait_events(HANDLE *events, int count, DWORD timeout, rb_thread_t *th);
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]