aboutsummaryrefslogtreecommitdiffstats
path: root/thread.c
diff options
context:
space:
mode:
Diffstat (limited to 'thread.c')
-rw-r--r--thread.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/thread.c b/thread.c
index c596b5bc12..096ac036ba 100644
--- a/thread.c
+++ b/thread.c
@@ -263,7 +263,7 @@ rb_thread_s_debug_set(VALUE self, VALUE val)
#endif
#ifndef fill_thread_id_str
-# define fill_thread_id_string(thid, buf) (thid)
+# define fill_thread_id_string(thid, buf) ((void *)(thid))
# define fill_thread_id_str(th) (void)0
# define thread_id_str(th) ((void *)(th)->thread_id)
# define PRI_THREAD_ID "p"
@@ -281,8 +281,8 @@ static void timer_thread_function(void *);
#define DEBUG_OUT() \
WaitForSingleObject(&debug_mutex, INFINITE); \
- printf(POSITION_FORMAT"%#lx - %s" POSITION_ARGS, GetCurrentThreadId(), buf); \
- fflush(stdout); \
+ fprintf(stderr, POSITION_FORMAT"%#lx - %s" POSITION_ARGS, \
+ GetCurrentThreadId(), buf); \
ReleaseMutex(&debug_mutex);
#elif defined(HAVE_PTHREAD_H)
@@ -290,9 +290,8 @@ static void timer_thread_function(void *);
#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); \
+ fprintf(stderr, POSITION_FORMAT"%"PRI_THREAD_ID" - %s" POSITION_ARGS, \
+ fill_thread_id_string(pthread_self(), thread_id_string), buf); \
pthread_mutex_unlock(&debug_mutex);
#else