From dc3697f62f4eb78093be3c95a8f8f265d3f184f5 Mon Sep 17 00:00:00 2001 From: nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> Date: Fri, 8 Jul 2011 23:37:08 +0000 Subject: [PATCH] * io.c (rb_io_close): close(2) on a fd which is being read by another thread causes deadlock on Mac OS X 10.5 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32462 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ io.c | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/ChangeLog b/ChangeLog index cf283ab3ae..46f8d613b0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sat Jul 9 08:37:05 2011 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * io.c (rb_io_close): close(2) on a fd which is being read by + another thread causes deadlock on Mac OS X 10.5 + Fri Jul 8 21:20:39 2011 NARUSE, Yui <naruse@ruby-lang.org> * addr2line.c: use USE_ELF instead of __ELF__ because Solaris diff --git a/io.c b/io.c index e5372aa820..90cc2b3a30 100644 --- a/io.c +++ b/io.c @@ -3621,6 +3621,12 @@ rb_io_close(VALUE io) if (fptr->fd < 0) return Qnil; fd = fptr->fd; +#if defined __APPLE__ && defined(__MACH__) && \ + (!defined(MAC_OS_X_VERSION_MIN_ALLOWED) || MAC_OS_X_VERSION_MIN_ALLOWED <= 1050) + /* close(2) on a fd which is being read by another thread causes + * deadlock on Mac OS X 10.5 */ + rb_thread_fd_close(fd); +#endif rb_io_fptr_cleanup(fptr, FALSE); rb_thread_fd_close(fd);