summaryrefslogtreecommitdiff
path: root/thread.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-01-25 14:34:07 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-01-25 14:34:07 +0000
commit61701ae1675f790ee3f59207283642dbe64c2d37 (patch)
tree89c4fa4d83f1e8308c02485ea8623b823b697343 /thread.c
parenta7bc6c1b8fb2cd2826f541fb159994752158fbee (diff)
io.c: close before wait
* io.c (io_close_fptr): notify then close, and wait for other threads before free fptr. [ruby-core:79262] [Bug #13158] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57422 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread.c')
-rw-r--r--thread.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/thread.c b/thread.c
index c94c3b93ab..9292d78ea6 100644
--- a/thread.c
+++ b/thread.c
@@ -2163,14 +2163,13 @@ rb_threadptr_reset_raised(rb_thread_t *th)
return 1;
}
-void
-rb_thread_fd_close(int fd)
+int
+rb_notify_fd_close(int fd)
{
rb_vm_t *vm = GET_THREAD()->vm;
rb_thread_t *th = 0;
int busy;
- retry:
busy = 0;
list_for_each(&vm->living_threads, th, vmlt_node) {
if (th->waiting_fd == fd) {
@@ -2180,10 +2179,7 @@ rb_thread_fd_close(int fd)
busy = 1;
}
}
- if (busy) {
- rb_thread_schedule_limits(0);
- goto retry;
- }
+ return busy;
}
/*