ruby-changes:46980
From: eregon <ko1@a...>
Date: Thu, 15 Jun 2017 22:34:38 +0900 (JST)
Subject: [ruby-changes:46980] eregon:r59095 (trunk): Update to ruby/spec@c730f07
eregon 2017-06-15 22:34:32 +0900 (Thu, 15 Jun 2017) New Revision: 59095 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=59095 Log: Update to ruby/spec@c730f07 Modified files: trunk/spec/rubyspec/optional/capi/ext/thread_spec.c Index: spec/rubyspec/optional/capi/ext/thread_spec.c =================================================================== --- spec/rubyspec/optional/capi/ext/thread_spec.c (revision 59094) +++ spec/rubyspec/optional/capi/ext/thread_spec.c (revision 59095) @@ -28,23 +28,27 @@ static VALUE thread_spec_rb_thread_alone https://github.com/ruby/ruby/blob/trunk/spec/rubyspec/optional/capi/ext/thread_spec.c#L28 static void* blocking_gvl_func(void* data) { int rfd = *(int *)data; char dummy; - ssize_t rv; + ssize_t r; do { - rv = read(rfd, &dummy, 1); - } while (rv == -1 && errno == EINTR); + r = read(rfd, &dummy, 1); + } while (r == -1 && errno == EINTR); - return (void*)((rv == 1) ? Qtrue : Qfalse); + close(rfd); + + return (void*)((r == 1) ? Qtrue : Qfalse); } static void unblock_gvl_func(void *data) { int wfd = *(int *)data; - char dummy = 0; - ssize_t rv; + char dummy = 'A'; + ssize_t r; do { - rv = write(wfd, &dummy, 1); - } while (rv == -1 && errno == EINTR); + r = write(wfd, &dummy, 1); + } while (r == -1 && errno == EINTR); + + close(wfd); } /* Returns true if the thread is interrupted. */ @@ -57,8 +61,6 @@ static VALUE thread_spec_rb_thread_call_ https://github.com/ruby/ruby/blob/trunk/spec/rubyspec/optional/capi/ext/thread_spec.c#L61 } ret = rb_thread_call_without_gvl(blocking_gvl_func, &fds[0], unblock_gvl_func, &fds[1]); - close(fds[0]); - close(fds[1]); return (VALUE)ret; } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/