ruby-changes:54022
From: normal <ko1@a...>
Date: Thu, 6 Dec 2018 19:09:37 +0900 (JST)
Subject: [ruby-changes:54022] normal:r66242 (trunk): io.c (io_write_nonblock): add RB_GC_GUARD, io_fflush may switch threads
normal 2018-12-06 19:09:30 +0900 (Thu, 06 Dec 2018) New Revision: 66242 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=66242 Log: io.c (io_write_nonblock): add RB_GC_GUARD, io_fflush may switch threads Since io_fflush may block on mutex or rb_io_wait_readable and switch threads, we need to ensure the `str' VALUE returned by `rb_obj_as_string` is visible to GC. Modified files: trunk/io.c Index: io.c =================================================================== --- io.c (revision 66241) +++ io.c (revision 66242) @@ -3001,6 +3001,7 @@ io_write_nonblock(VALUE io, VALUE str, V https://github.com/ruby/ruby/blob/trunk/io.c#L3001 rb_io_set_nonblock(fptr); n = write(fptr->fd, RSTRING_PTR(str), RSTRING_LEN(str)); + RB_GC_GUARD(str); if (n < 0) { int e = errno; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/