Update to ruby/spec@c730f07
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59095 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
56b83d06e8
commit
2fbd11c77a
@ -28,23 +28,27 @@ static VALUE thread_spec_rb_thread_alone() {
|
|||||||
static void* blocking_gvl_func(void* data) {
|
static void* blocking_gvl_func(void* data) {
|
||||||
int rfd = *(int *)data;
|
int rfd = *(int *)data;
|
||||||
char dummy;
|
char dummy;
|
||||||
ssize_t rv;
|
ssize_t r;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
rv = read(rfd, &dummy, 1);
|
r = read(rfd, &dummy, 1);
|
||||||
} while (rv == -1 && errno == EINTR);
|
} 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) {
|
static void unblock_gvl_func(void *data) {
|
||||||
int wfd = *(int *)data;
|
int wfd = *(int *)data;
|
||||||
char dummy = 0;
|
char dummy = 'A';
|
||||||
ssize_t rv;
|
ssize_t r;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
rv = write(wfd, &dummy, 1);
|
r = write(wfd, &dummy, 1);
|
||||||
} while (rv == -1 && errno == EINTR);
|
} while (r == -1 && errno == EINTR);
|
||||||
|
|
||||||
|
close(wfd);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Returns true if the thread is interrupted. */
|
/* Returns true if the thread is interrupted. */
|
||||||
@ -57,8 +61,6 @@ static VALUE thread_spec_rb_thread_call_without_gvl(VALUE self) {
|
|||||||
}
|
}
|
||||||
ret = rb_thread_call_without_gvl(blocking_gvl_func, &fds[0],
|
ret = rb_thread_call_without_gvl(blocking_gvl_func, &fds[0],
|
||||||
unblock_gvl_func, &fds[1]);
|
unblock_gvl_func, &fds[1]);
|
||||||
close(fds[0]);
|
|
||||||
close(fds[1]);
|
|
||||||
return (VALUE)ret;
|
return (VALUE)ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user