diff options
-rw-r--r-- | thread.c | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -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 |