ruby-changes:26347
From: kosaki <ko1@a...>
Date: Sat, 15 Dec 2012 14:40:07 +0900 (JST)
Subject: [ruby-changes:26347] kosaki:r38398 (trunk): * io.c (internal_write_func2): new helper function for rb_write_internal2().
kosaki 2012-12-15 14:39:57 +0900 (Sat, 15 Dec 2012) New Revision: 38398 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=38398 Log: * 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] Modified files: trunk/ChangeLog trunk/io.c Index: ChangeLog =================================================================== --- ChangeLog (revision 38397) +++ ChangeLog (revision 38398) @@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sat Dec 15 13:04:26 2012 KOSAKI Motohiro <kosaki.motohiro@g...> + + * 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@g...> * io.c (rb_io_wait_writable): add to call rb_thread_wait_fd() Index: io.c =================================================================== --- io.c (revision 38397) +++ io.c (revision 38398) @@ -900,6 +900,13 @@ internal_write_func(void *ptr) https://github.com/ruby/ruby/blob/trunk/io.c#L900 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 *bu https://github.com/ruby/ruby/blob/trunk/io.c#L929 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) https://github.com/ruby/ruby/blob/trunk/io.c#L1131 { 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/