about summary refs log tree commit homepage
path: root/ext/sleepy_penguin/timerfd.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/sleepy_penguin/timerfd.c')
-rw-r--r--ext/sleepy_penguin/timerfd.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/ext/sleepy_penguin/timerfd.c b/ext/sleepy_penguin/timerfd.c
index a4f5c7d..e3af46c 100644
--- a/ext/sleepy_penguin/timerfd.c
+++ b/ext/sleepy_penguin/timerfd.c
@@ -31,10 +31,8 @@ static VALUE s_new(int argc, VALUE *argv, VALUE klass)
 
         fd = timerfd_create(clockid, flags);
         if (fd < 0) {
-                if (errno == EMFILE || errno == ENFILE || errno == ENOMEM) {
-                        rb_gc();
+                if (rb_sp_gc_for_fd(errno))
                         fd = timerfd_create(clockid, flags);
-                }
                 if (fd < 0)
                         rb_sys_fail("timerfd_create");
         }