about summary refs log tree commit homepage
path: root/ext/kgio/poll.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/kgio/poll.c')
-rw-r--r--ext/kgio/poll.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/ext/kgio/poll.c b/ext/kgio/poll.c
index ae8d235..41bebf6 100644
--- a/ext/kgio/poll.c
+++ b/ext/kgio/poll.c
@@ -107,14 +107,16 @@ static void hash2pollfds(struct poll_args *a)
         rb_hash_foreach(a->ios, io_to_pollfd_i, (VALUE)a);
 }
 
-static VALUE nogvl_poll(void *ptr)
+static void * nogvl_poll(void *ptr)
 {
         struct poll_args *a = ptr;
+        long n;
 
         if (a->timeout > 0)
                 clock_gettime(hopefully_CLOCK_MONOTONIC, &a->start);
 
-        return (VALUE)poll(a->fds, a->nfds, a->timeout);
+        n = poll(a->fds, a->nfds, a->timeout);
+        return (void *)n;
 }
 
 static VALUE poll_result(int nr, struct poll_args *a)
@@ -145,7 +147,7 @@ static VALUE do_poll(VALUE args)
 
 retry:
         hash2pollfds(a);
-        nr = (long)rb_thread_blocking_region(nogvl_poll, a, RUBY_UBF_IO, NULL);
+        nr = (long)KGIO_WITHOUT_GVL(nogvl_poll, a, RUBY_UBF_IO, NULL);
         if (nr < 0) {
                 if (interrupted()) {
                         if (retryable(a)) {