diff options
author | Eric Wong <e@80x24.org> | 2017-03-16 20:07:13 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2017-03-16 20:10:32 +0000 |
commit | 3b64b24b38482ddc5a65eae3408a9eafec4b7aae (patch) | |
tree | fa1e120c1a1c6750cac3bebdc6e4b9d010aea78e /ext | |
parent | e7703d878199f24432f707c359668a721b681a77 (diff) | |
download | sleepy_penguin-3b64b24b38482ddc5a65eae3408a9eafec4b7aae.tar.gz |
Ruby 1.8 is long dead and we already broke 1.9 support by using keyword args for splice, sendfile, and copy_file_range support.
Diffstat (limited to 'ext')
-rw-r--r-- | ext/sleepy_penguin/epoll.c | 3 | ||||
-rw-r--r-- | ext/sleepy_penguin/eventfd.c | 7 | ||||
-rw-r--r-- | ext/sleepy_penguin/inotify.c | 2 | ||||
-rw-r--r-- | ext/sleepy_penguin/kqueue.c | 3 | ||||
-rw-r--r-- | ext/sleepy_penguin/sleepy_penguin.h | 29 | ||||
-rw-r--r-- | ext/sleepy_penguin/timerfd.c | 2 |
6 files changed, 6 insertions, 40 deletions
diff --git a/ext/sleepy_penguin/epoll.c b/ext/sleepy_penguin/epoll.c index 512e11c..50a3a6f 100644 --- a/ext/sleepy_penguin/epoll.c +++ b/ext/sleepy_penguin/epoll.c @@ -329,9 +329,6 @@ void sleepy_penguin_init_epoll(void) id_for_fd = rb_intern("for_fd"); - if (RB_SP_GREEN_THREAD) - rb_require("sleepy_penguin/epoll/io"); - /* the high-level interface is implemented in Ruby: */ rb_require("sleepy_penguin/epoll"); } diff --git a/ext/sleepy_penguin/eventfd.c b/ext/sleepy_penguin/eventfd.c index 4804150..1cb2c4e 100644 --- a/ext/sleepy_penguin/eventfd.c +++ b/ext/sleepy_penguin/eventfd.c @@ -82,7 +82,9 @@ static VALUE incr(int argc, VALUE *argv, VALUE self) rb_scan_args(argc, argv, "11", &value, &nonblock); x.fd = rb_sp_fileno(self); - RTEST(nonblock) ? rb_sp_set_nonblock(x.fd) : blocking_io_prepare(x.fd); + if (RTEST(nonblock)) + rb_sp_set_nonblock(x.fd); + x.val = (uint64_t)NUM2ULL(value); retry: w = (ssize_t)rb_sp_fd_region(efd_write, &x, x.fd); @@ -119,7 +121,8 @@ static VALUE getvalue(int argc, VALUE *argv, VALUE self) rb_scan_args(argc, argv, "01", &nonblock); x.fd = rb_sp_fileno(self); - RTEST(nonblock) ? rb_sp_set_nonblock(x.fd) : blocking_io_prepare(x.fd); + if (RTEST(nonblock)) + rb_sp_set_nonblock(x.fd); retry: w = (ssize_t)rb_sp_fd_region(efd_read, &x, x.fd); if (w < 0) { diff --git a/ext/sleepy_penguin/inotify.c b/ext/sleepy_penguin/inotify.c index 56fcff2..ebc1f65 100644 --- a/ext/sleepy_penguin/inotify.c +++ b/ext/sleepy_penguin/inotify.c @@ -236,8 +236,6 @@ static VALUE take(int argc, VALUE *argv, VALUE self) if (args.nonblock_p) rb_sp_set_nonblock(args.fd); - else - blocking_io_prepare(args.fd); args.buf = 0; return rb_ensure(do_take, (VALUE)&args, diff --git a/ext/sleepy_penguin/kqueue.c b/ext/sleepy_penguin/kqueue.c index 22a2c5d..c368514 100644 --- a/ext/sleepy_penguin/kqueue.c +++ b/ext/sleepy_penguin/kqueue.c @@ -657,9 +657,6 @@ void sleepy_penguin_init_kqueue(void) id_for_fd = rb_intern("for_fd"); - if (RB_SP_GREEN_THREAD) - rb_require("sleepy_penguin/kqueue/io"); - /* the high-level interface is implemented in Ruby: */ rb_require("sleepy_penguin/kqueue"); diff --git a/ext/sleepy_penguin/sleepy_penguin.h b/ext/sleepy_penguin/sleepy_penguin.h index bd44e18..7b2074a 100644 --- a/ext/sleepy_penguin/sleepy_penguin.h +++ b/ext/sleepy_penguin/sleepy_penguin.h @@ -19,16 +19,6 @@ int rb_sp_io_closed(VALUE io); int rb_sp_fileno(VALUE io); void rb_sp_set_nonblock(int fd); -#if defined(HAVE_RB_THREAD_BLOCKING_REGION) || \ - defined(HAVE_RB_THREAD_IO_BLOCKING_REGION) || \ - defined(HAVE_RB_THREAD_CALL_WITHOUT_GVL) -# define RB_SP_GREEN_THREAD 0 -# define blocking_io_prepare(fd) ((void)(fd)) -#else -# define RB_SP_GREEN_THREAD 1 -# define blocking_io_prepare(fd) rb_sp_set_nonblock((fd)) -#endif - #ifdef HAVE_RB_THREAD_IO_BLOCKING_REGION /* Ruby 1.9.3 and 2.0.0 */ VALUE rb_thread_io_blocking_region(rb_blocking_function_t *, void *, int); @@ -46,24 +36,7 @@ VALUE rb_thread_io_blocking_region(rb_blocking_function_t *, void *, int); # define rb_sp_fd_region(fn,data,fd) \ rb_thread_blocking_region((fn),(data),RUBY_UBF_IO,NULL) #else -/* - * Ruby 1.8 does not have a GVL, we'll just enable signal interrupts - * here in case we make interruptible syscalls. - * - * Note: epoll_wait with timeout=0 was interruptible until Linux 2.6.39 - */ -# include <rubysig.h> -static inline VALUE fake_blocking_region(VALUE (*fn)(void *), void *data) -{ - VALUE rv; - - TRAP_BEG; - rv = fn(data); - TRAP_END; - - return rv; -} -# define rb_sp_fd_region(fn,data,fd) fake_blocking_region((fn),(data)) +# error Ruby <= 1.8 not supported #endif #define NODOC_CONST(klass,name,value) \ diff --git a/ext/sleepy_penguin/timerfd.c b/ext/sleepy_penguin/timerfd.c index e3af46c..7957802 100644 --- a/ext/sleepy_penguin/timerfd.c +++ b/ext/sleepy_penguin/timerfd.c @@ -120,8 +120,6 @@ static VALUE expirations(int argc, VALUE *argv, VALUE self) rb_scan_args(argc, argv, "01", &nonblock); if (RTEST(nonblock)) rb_sp_set_nonblock(fd); - else - blocking_io_prepare(fd); retry: r = (ssize_t)rb_sp_fd_region(tfd_read, &buf, fd); if (r < 0) { |