diff options
author | Eric Wong <normalperson@yhbt.net> | 2011-05-19 22:43:18 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2011-05-19 22:43:18 +0000 |
commit | ff020c21f772debbb1a1b247b11325c747288fcb (patch) | |
tree | 9fb7507a98094f7c11d52c839fa842b2f414657a /ext/sleepy_penguin/eventfd.c | |
parent | b9b8de52999d6f933f0a21f671fbf8c8f53979c0 (diff) | |
download | sleepy_penguin-ff020c21f772debbb1a1b247b11325c747288fcb.tar.gz |
We don't want to operate on improper FDs in multithreaded environment. This affects MRI despite the GVL since file descriptors are usually allocated without the GVL held (open()/accept()).
Diffstat (limited to 'ext/sleepy_penguin/eventfd.c')
-rw-r--r-- | ext/sleepy_penguin/eventfd.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/ext/sleepy_penguin/eventfd.c b/ext/sleepy_penguin/eventfd.c index 4da5e45..9d75c91 100644 --- a/ext/sleepy_penguin/eventfd.c +++ b/ext/sleepy_penguin/eventfd.c @@ -87,7 +87,7 @@ static VALUE incr(int argc, VALUE *argv, VALUE self) RTEST(nonblock) ? rb_sp_set_nonblock(x.fd) : blocking_io_prepare(x.fd); x.val = (uint64_t)NUM2ULL(value); retry: - w = (ssize_t)rb_sp_io_region(efd_write, &x); + w = (ssize_t)rb_sp_fd_region(efd_write, &x, x.fd); if (w == -1) { if (errno == EAGAIN && RTEST(nonblock)) return Qfalse; @@ -123,11 +123,11 @@ static VALUE getvalue(int argc, VALUE *argv, VALUE self) x.fd = rb_sp_fileno(self); RTEST(nonblock) ? rb_sp_set_nonblock(x.fd) : blocking_io_prepare(x.fd); retry: - w = (ssize_t)rb_sp_io_region(efd_read, &x); + w = (ssize_t)rb_sp_fd_region(efd_read, &x, x.fd); if (w == -1) { if (errno == EAGAIN && RTEST(nonblock)) return Qnil; - if (rb_io_wait_readable(x.fd)) + if (rb_io_wait_readable(x.fd = rb_sp_fileno(self))) goto retry; rb_sys_fail("read(eventfd)"); } |