about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2010-09-26 06:00:10 +0000
committerEric Wong <e@yhbt.net>2010-09-26 06:06:52 +0000
commit43124e76e219d0be968fdeb09f6389d6895b0caf (patch)
tree66dc77ce0ad606c59125d28b45ecde8b9539b86c
parentf3fd4447b650e75f48ac0fb9bada9b411c4b89cd (diff)
downloadsleepy_penguin-43124e76e219d0be968fdeb09f6389d6895b0caf.tar.gz
Rubinius 1.1.1 does not include this function

ref: http://github.com/evanphx/rubinius/issues/497
-rw-r--r--ext/sleepy_penguin/epoll.c6
-rw-r--r--ext/sleepy_penguin/extconf.rb1
2 files changed, 7 insertions, 0 deletions
diff --git a/ext/sleepy_penguin/epoll.c b/ext/sleepy_penguin/epoll.c
index 1c75f8f..6db69d4 100644
--- a/ext/sleepy_penguin/epoll.c
+++ b/ext/sleepy_penguin/epoll.c
@@ -21,6 +21,12 @@ static void rb_memerror(void)
         abort();
 }
 #endif
+#ifndef HAVE_RB_IO_CLOSE
+static VALUE rb_io_close(VALUE io)
+{
+        return rb_funcall(io, rb_intern("close"), 0);
+}
+#endif
 
 static st_table *active;
 static const int step = 64; /* unlikely to grow unless you're huge */
diff --git a/ext/sleepy_penguin/extconf.rb b/ext/sleepy_penguin/extconf.rb
index ad24aba..cb3ece7 100644
--- a/ext/sleepy_penguin/extconf.rb
+++ b/ext/sleepy_penguin/extconf.rb
@@ -5,6 +5,7 @@ have_header('sys/eventfd.h')
 have_header('sys/signalfd.h')
 have_header('sys/timerfd.h')
 have_func('rb_memerror')
+have_func('rb_io_close')
 have_func('epoll_create1', %w(sys/epoll.h))
 have_func('rb_thread_blocking_region')
 have_library('pthread')