diff options
author | Eric Wong <e@80x24.org> | 2017-01-02 00:23:36 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2017-01-02 00:23:36 +0000 |
commit | 207f50b31a41071d3154c2f752967e50ff056488 (patch) | |
tree | 6fcc11f39e1b8f1f584a8015b6cc79773a09ca51 /ext/sleepy_penguin/eventfd.c | |
parent | 3d1dd0aca4074a44fa5658de12eb8b89ff649114 (diff) | |
download | sleepy_penguin-207f50b31a41071d3154c2f752967e50ff056488.tar.gz |
This should hopefully simplify logic a bit and avoid expensive access to errno.
Diffstat (limited to 'ext/sleepy_penguin/eventfd.c')
-rw-r--r-- | ext/sleepy_penguin/eventfd.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/ext/sleepy_penguin/eventfd.c b/ext/sleepy_penguin/eventfd.c index 4f95b0d..4804150 100644 --- a/ext/sleepy_penguin/eventfd.c +++ b/ext/sleepy_penguin/eventfd.c @@ -31,10 +31,8 @@ static VALUE s_new(int argc, VALUE *argv, VALUE klass) fd = eventfd(initval, flags); if (fd < 0) { - if (errno == EMFILE || errno == ENFILE || errno == ENOMEM) { - rb_gc(); + if (rb_sp_gc_for_fd(errno)) fd = eventfd(initval, flags); - } if (fd < 0) rb_sys_fail("eventfd"); } |