summaryrefslogtreecommitdiff
path: root/thread.c
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-03-27 16:54:09 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-03-27 16:54:09 +0000
commit65639d44e962419bc1da1f1dfbec232abcced6cd (patch)
treedc2ace0c0068be2cf528397512ef4ead2b4eee3c /thread.c
parentd8a1986a05110b2468a256ab94936ef482f010bb (diff)
merge revision(s) 57422: [Backport #13158]
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/branches/ruby_2_3@58177 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 9cf5139687..6e9099b9f5 100644
--- a/thread.c
+++ b/thread.c
@@ -2168,14 +2168,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) {
@@ -2185,10 +2184,7 @@ rb_thread_fd_close(int fd)
busy = 1;
}
}
- if (busy) {
- rb_thread_schedule_limits(0);
- goto retry;
- }
+ return busy;
}
/*