зеркало из https://github.com/github/ruby.git
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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66242 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
956d35e2d0
Коммит
48324dd4db
1
io.c
1
io.c
|
@ -3001,6 +3001,7 @@ io_write_nonblock(VALUE io, VALUE str, VALUE ex)
|
|||
|
||||
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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче