summaryrefslogtreecommitdiff
path: root/thread_pthread.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-10-30 12:13:05 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-10-30 12:13:05 +0000
commit0d2a92e0b327bd69781dd51f34278e843d5f0b74 (patch)
treedcd7185f633011fc59a0d8710f37275eae61e085 /thread_pthread.c
parent6e0ed044b6d7e8247a49e85d622eab9f128dbdba (diff)
* include/ruby/intern.h (rb_cloexec_pipe): declared.
* io.c (rb_cloexec_pipe): new function. (rb_pipe): use rb_cloexec_pipe. * thread_pthread.c (rb_thread_create_timer_thread): use rb_cloexec_pipe. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33572 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread_pthread.c')
-rw-r--r--thread_pthread.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/thread_pthread.c b/thread_pthread.c
index be3148dc30..3e4231fd27 100644
--- a/thread_pthread.c
+++ b/thread_pthread.c
@@ -1210,12 +1210,12 @@ rb_thread_create_timer_thread(void)
close_communication_pipe();
}
- err = pipe(timer_thread_pipe);
+ err = rb_cloexec_pipe(timer_thread_pipe);
if (err != 0) {
rb_bug_errno("thread_timer: Failed to create communication pipe for timer thread", errno);
}
- rb_fd_set_cloexec(timer_thread_pipe[0]);
- rb_fd_set_cloexec(timer_thread_pipe[1]);
+ 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;
@@ -1224,12 +1224,6 @@ rb_thread_create_timer_thread(void)
oflags |= O_NONBLOCK;
fcntl(timer_thread_pipe[1], F_SETFL, oflags);
#endif /* defined(O_NONBLOCK) */
-#if defined(FD_CLOEXEC)
- oflags = fcntl(timer_thread_pipe[0], F_GETFD);
- fcntl(timer_thread_pipe[0], F_SETFD, oflags | FD_CLOEXEC);
- oflags = fcntl(timer_thread_pipe[1], F_GETFD);
- fcntl(timer_thread_pipe[1], F_SETFD, oflags | FD_CLOEXEC);
-#endif /* defined(FD_CLOEXEC) */
}
#endif /* defined(HAVE_FCNTL) && defined(F_GETFL) && defined(F_SETFL) */