From 2c7576a0214aab975bc6b7ac6e04eaa5aaf07d55 Mon Sep 17 00:00:00 2001 From: akr Date: Tue, 19 Jul 2011 07:10:19 +0000 Subject: [PATCH] * io.c (rb_update_max_fd): new function. * internal.h (rb_update_max_fd): declare rb_update_max_fd. * thread_pthread.c (rb_thread_create_timer_thread): update max fd when timer thread pipe is created. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32579 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 9 +++++++++ internal.h | 1 + io.c | 5 +++++ thread_pthread.c | 2 ++ 4 files changed, 17 insertions(+) diff --git a/ChangeLog b/ChangeLog index c59cbeb1df..d717e2951c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Tue Jul 19 16:07:45 2011 Tanaka Akira + + * io.c (rb_update_max_fd): new function. + + * internal.h (rb_update_max_fd): declare rb_update_max_fd. + + * thread_pthread.c (rb_thread_create_timer_thread): update max fd when + timer thread pipe is created. + Mon Jul 18 13:36:47 2011 Aaron Patterson * ext/psych/lib/psych.rb: define a new BadAlias error class. diff --git a/internal.h b/internal.h index 172e7f45ad..77f61da89d 100644 --- a/internal.h +++ b/internal.h @@ -101,6 +101,7 @@ const char *ruby_get_inplace_mode(void); void ruby_set_inplace_mode(const char *); ssize_t rb_io_bufread(VALUE io, void *buf, size_t size); void rb_stdio_set_default_encoding(void); +void rb_update_max_fd(int fd); /* iseq.c */ VALUE rb_iseq_compile_with_option(VALUE src, VALUE file, VALUE filepath, VALUE line, VALUE opt); diff --git a/io.c b/io.c index 090f383849..f53c5daf53 100644 --- a/io.c +++ b/io.c @@ -155,6 +155,11 @@ static int max_file_descriptor = NOFILE; do { \ if (max_file_descriptor < (fd)) max_file_descriptor = (fd); \ } while (0) +void +rb_update_max_fd(int fd) +{ + UPDATE_MAXFD(fd); +} #define argf_of(obj) (*(struct argf *)DATA_PTR(obj)) #define ARGF argf_of(argf) diff --git a/thread_pthread.c b/thread_pthread.c index 13a8b359e1..8ef34dd15f 100644 --- a/thread_pthread.c +++ b/thread_pthread.c @@ -1191,6 +1191,8 @@ rb_thread_create_timer_thread(void) if (err != 0) { rb_bug_errno("thread_timer: Failed to create communication pipe for timer thread", errno); } + rb_update_max_fd(timer_thread_pipe[0]); + rb_update_max_fd(timer_thread_pipe[1]); #if defined(HAVE_FCNTL) && defined(F_GETFL) && defined(F_SETFL) { int oflags;