* io.c (internal_write_func2): new helper function for rb_write_internal2().

* io.c (rb_write_internal2): new function. it uses
  rb_thread_call_without_gvl2() instaed of rb_thread_io_blocking_region().
* io.c (rb_binwrite_string): uses rb_write_internal2 instead of
  rb_write_internal. [Bug #7134]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38398 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
kosaki 2012-12-15 05:39:57 +00:00
Родитель 96350867e1
Коммит 2a4d86f385
2 изменённых файлов: 28 добавлений и 1 удалений

Просмотреть файл

@ -1,3 +1,11 @@
Sat Dec 15 13:04:26 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
* io.c (internal_write_func2): new helper function for rb_write_internal2().
* io.c (rb_write_internal2): new function. it uses
rb_thread_call_without_gvl2() instaed of rb_thread_io_blocking_region().
* io.c (rb_binwrite_string): uses rb_write_internal2 instead of
rb_write_internal. [Bug #7134]
Sat Dec 15 12:55:29 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
* io.c (rb_io_wait_writable): add to call rb_thread_wait_fd()

21
io.c
Просмотреть файл

@ -900,6 +900,13 @@ internal_write_func(void *ptr)
return write(iis->fd, iis->buf, iis->capa);
}
static void*
internal_write_func2(void *ptr)
{
struct io_internal_write_struct *iis = ptr;
return (void*)(intptr_t)write(iis->fd, iis->buf, iis->capa);
}
static ssize_t
rb_read_internal(int fd, void *buf, size_t count)
{
@ -922,6 +929,18 @@ rb_write_internal(int fd, const void *buf, size_t count)
return (ssize_t)rb_thread_io_blocking_region(internal_write_func, &iis, fd);
}
static ssize_t
rb_write_internal2(int fd, const void *buf, size_t count)
{
struct io_internal_write_struct iis;
iis.fd = fd;
iis.buf = buf;
iis.capa = count;
return (ssize_t)rb_thread_call_without_gvl2(internal_write_func2, &iis,
RUBY_UBF_IO, NULL);
}
static long
io_writable_length(rb_io_t *fptr, long l)
{
@ -1112,7 +1131,7 @@ io_binwrite_string(VALUE arg)
{
struct binwrite_arg *p = (struct binwrite_arg *)arg;
long l = io_writable_length(p->fptr, p->length);
return rb_write_internal(p->fptr->fd, p->ptr, l);
return rb_write_internal2(p->fptr->fd, p->ptr, l);
}
static long