summaryrefslogtreecommitdiffstats
path: root/thread_pthread.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-01 21:50:01 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-01 21:50:01 +0000
commitb4df610c2733fb8b8a1f431940b4e5d1a58e2d47 (patch)
tree75ef654a0efc94268b2cab1f3b75770a966bc392 /thread_pthread.c
parent0aca84d0884e41217a1d9e2a5532befd2d61a442 (diff)
downloadruby-b4df610c2733fb8b8a1f431940b4e5d1a58e2d47.tar.gz
ruby-b4df610c2733fb8b8a1f431940b4e5d1a58e2d47.tar.xz
ruby-b4df610c2733fb8b8a1f431940b4e5d1a58e2d47.zip
* signal.c (rb_signal_buff_size): defined for check whether signal
is in the buffer or not. * thread_pthread.c (thread_timer): don't exit the loop when signal is in the buffer. [ruby-dev:37637] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@21265 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread_pthread.c')
-rw-r--r--thread_pthread.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/thread_pthread.c b/thread_pthread.c
index a23e7727d..72f8a2f28 100644
--- a/thread_pthread.c
+++ b/thread_pthread.c
@@ -741,19 +741,24 @@ get_ts(struct timespec *ts, unsigned long nsec)
return ts;
}
+int rb_signal_buff_size(void);
+
static void *
thread_timer(void *dummy)
{
struct timespec ts;
- int err;
native_mutex_lock(&timer_thread_lock);
native_cond_broadcast(&timer_thread_cond);
#define WAIT_FOR_10MS() native_cond_timedwait(&timer_thread_cond, &timer_thread_lock, get_ts(&ts, PER_NANO/100))
- while (system_working > 0 && (err = WAIT_FOR_10MS()) != 0 && err != EINTR) {
- if (err != ETIMEDOUT) {
- rb_bug("thread_timer/timedwait: %d", err);
+ while (system_working > 0) {
+ int err = WAIT_FOR_10MS();
+ if (err == ETIMEDOUT);
+ else if (err == 0 || err == EINTR) {
+ if (rb_signal_buff_size() == 0) break;
}
+ else rb_bug("thread_timer/timedwait: %d", err);
+
#ifndef __CYGWIN__
if (signal_thread_list_anchor.next) {
FGLOCK(&signal_thread_list_lock, {