aboutsummaryrefslogtreecommitdiffstats
path: root/thread_pthread.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-09-06 15:19:47 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-09-06 15:19:47 +0000
commita58437622eba72e1cd661d12d1d2f228d61db627 (patch)
treee0ff0e01512b0fad6f7ecc0c584ecb6db4e7b94f /thread_pthread.c
parent46a83bcc68a50c40ce8c8031983a92a23cbbad64 (diff)
downloadruby-a58437622eba72e1cd661d12d1d2f228d61db627.tar.gz
thread_pthread.c: async bug messages
* thread_pthread.c (consume_communication_pipe, CLOSE_INVALIDATE): adjust async bug messages. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51777 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread_pthread.c')
-rw-r--r--thread_pthread.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/thread_pthread.c b/thread_pthread.c
index 0446501d14..fb76020cc9 100644
--- a/thread_pthread.c
+++ b/thread_pthread.c
@@ -1294,7 +1294,7 @@ rb_thread_wakeup_timer_thread_fd(volatile int *fdp)
/* already opened */
if (fd >= 0 && timer_thread_pipe.owner_process == getpid()) {
- const char *buff = "!";
+ static const char buff[1] = {'!'};
retry:
if ((result = write(fd, buff, 1)) <= 0) {
int e = errno;
@@ -1358,13 +1358,14 @@ consume_communication_pipe(int fd)
#endif
return;
default:
- rb_async_bug_errno("consume_communication_pipe: read\n", e);
+ rb_async_bug_errno("consume_communication_pipe: read", e);
}
}
}
}
-#define CLOSE_INVALIDATE(expr) close_invalidate(&expr,#expr)
+#define CLOSE_INVALIDATE(expr) \
+ close_invalidate(&timer_thread_pipe.expr,"close_invalidate: "#expr)
static void
close_invalidate(volatile int *fdp, const char *msg)
{
@@ -1424,8 +1425,8 @@ setup_communication_pipe(void)
}
if (setup_communication_pipe_internal(timer_thread_pipe.low) < 0) {
int e = errno;
- CLOSE_INVALIDATE(timer_thread_pipe.normal[0]);
- CLOSE_INVALIDATE(timer_thread_pipe.normal[1]);
+ CLOSE_INVALIDATE(normal[0]);
+ CLOSE_INVALIDATE(normal[1]);
return e;
}
@@ -1569,8 +1570,8 @@ thread_timer(void *p)
timer_thread_sleep(gvl);
}
#if USE_SLEEPY_TIMER_THREAD
- CLOSE_INVALIDATE(timer_thread_pipe.normal[0]);
- CLOSE_INVALIDATE(timer_thread_pipe.low[0]);
+ CLOSE_INVALIDATE(normal[0]);
+ CLOSE_INVALIDATE(low[0]);
#else
native_mutex_unlock(&timer_thread_lock);
native_cond_destroy(&timer_thread_cond);
@@ -1631,10 +1632,10 @@ rb_thread_create_timer_thread(void)
if (err != 0) {
rb_warn("pthread_create failed for timer: %s, scheduling broken",
strerror(err));
- CLOSE_INVALIDATE(timer_thread_pipe.normal[0]);
- CLOSE_INVALIDATE(timer_thread_pipe.normal[1]);
- CLOSE_INVALIDATE(timer_thread_pipe.low[0]);
- CLOSE_INVALIDATE(timer_thread_pipe.low[1]);
+ CLOSE_INVALIDATE(normal[0]);
+ CLOSE_INVALIDATE(normal[1]);
+ CLOSE_INVALIDATE(low[0]);
+ CLOSE_INVALIDATE(low[1]);
return;
}
timer_thread.created = 1;
@@ -1665,8 +1666,8 @@ native_stop_timer_thread(void)
}
/* stop writing ends of pipes so timer thread notices EOF */
- CLOSE_INVALIDATE(timer_thread_pipe.normal[1]);
- CLOSE_INVALIDATE(timer_thread_pipe.low[1]);
+ CLOSE_INVALIDATE(normal[1]);
+ CLOSE_INVALIDATE(low[1]);
/* timer thread will stop looping when system_working <= 0: */
native_thread_join(timer_thread.id);