[BUG:trunk] Re: [ruby-cvs:28403] Ruby:r21185 (trunk): * thread.c (rb_thread_blocking_region): add a


#1

e$B$"$1$^$7$F$*$a$G$H$&$4$6$$$^$9!"$J$+$`$ie(B(e$B$&e(B)e$B$G$9!#e(B

In message “[ruby-cvs:28403] Ruby:r21185 (trunk): * thread.c
(rb_thread_blocking_region): add a comment.”
on Dec.30,2008 16:57:54, removed_email_address@domain.invalid wrote:
| ko1 2008-12-30 16:57:53 +0900 (Tue, 30 Dec 2008)
|
| New Revision: 21185
|
| http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=21185
|
| Log:
| * thread.c (rb_thread_blocking_region): add a comment.
| * thread.c (rb_thread_call_without_gvl): added as a alias of
| rb_thread_blocking_region().
| * thread.c (rb_thread_call_with_gvl): added.
| * vm_core.h (rb_thread_t#blocking_region_buffer): added for
| rb_thread_call_with_gvl().

e$B$a$G$?$/e(Brb_thread_call_with_gvl()e$B$,F~$j$^$7$?$,!"e(Brb_thread_t
e$B$KDI2C$5$l$?%a%s%Pe(Bblocking_region_buffere$B$KCM$r@Dj$7$F$$$k$He(B
e$B$3$m$,B8:
$7$J$$$h$&$J5$$,$7$^$9!#e(B

e$B$"$H!"$3$C$A$Oe(Bbuge$B$8$c$J$/$F%j%/%(%9%H$G$9$,!“e(BCe$B4X?t$+$i<+%9%le(B
e$B%C%I$,e(BGVLe$B$r<hF@$7$F$$$k$+$I$&$+$rH=CG$9$k$N$,:$Fq!”$H$$$&$+!“e(B
rb_thread_call_with_gvl()e$BFb$G$d$C$F$k$N$HF1$8$3$H$r$d$kI,MW$,e(B
e$B$”$C$FFsEY<j4V$K$J$k$N$G!"e(Brb_thread_call_with_gvl()e$BFb$Ge(BGVLe$B<he(B
e$BF@$NM-L5$r3NG’$7$F$h$-$K7W$i$C$F$/$l$?J}$,$$$$$h$&$K;W$$$^$9!#e(B

e$B0JA0$5$5$@$5$s$K$Oe(BIRCe$B$G!V$$$i$J$$!W$H8@$C$F$7$^$C$?5$$b$7$^e(B

e$B$9$,!"$d$C$Q$jI,MW$G$7$?!#e(B

e$B$$$A$$&!"0J>ee(B2e$BE@$N%Q%C%A$r$D$1$F$$-$^$9!#e(B

Index: thread.c

— thread.c (e$B%j%S%8%g%se(B 21276)
+++ thread.c (e$B:n6H%3%T!<e(B)
@@ -954,6 +954,7 @@
{
region->prev_status = th->status;
set_unblock_function(th, func, arg, &region->oldubf);

  • th->blocking_region_buffer = region;
    th->status = THREAD_STOPPED;
    thread_debug(“enter blocking region (%p)\n”, (void *)th);
    rb_gc_save_machine_context(th);
    @@ -967,6 +968,7 @@
    rb_thread_set_current(th);
    thread_debug(“leave blocking region (%p)\n”, (void *)th);
    remove_signal_thread_list(th);

  • th->blocking_region_buffer = NULL;
    reset_unblock_function(th, &region->oldubf);
    if (th->status == THREAD_STOPPED) {
    th->status = region->prev_status;
    @@ -1101,13 +1103,15 @@
    }

    brb = (struct rb_blocking_region_buffer
    *)th->blocking_region_buffer;

  • prev_unblock = th->unblock;
  • blocking_region_end(th, brb);
  • if (brb) {
  • prev_unblock = th->unblock;
  • blocking_region_end(th, brb);
  • }
    /* enter to Ruby world: You can access Ruby values, methods and so
    on. */
    r = (*func)(data1);
  • /* levae from Ruby world: You can not access Ruby values, etc. */
  • blocking_region_begin(th, brb, prev_unblock.func,
    prev_unblock.arg);
  • /* leave from Ruby world: You can not access Ruby values, etc. */
  • if (brb)
  • blocking_region_begin(th, brb, prev_unblock.func, prev_unblock.arg);
    return r;
    }

e$B$=$l$G$O!#e(B


#2

e$B!!$5$5$@$G$9!%e(B

U.Nakamura wrote::

e$B$9$,!"$d$C$Q$jI,MW$G$7$?!#e(B

e$B!!$3$NLdBj$O!$G/$N=i$a$K?’!9e(B IRC
e$B$J$j%*%U%i%$%s$J$j$G5DO@$7$^$7$?$,!$e(B
xmalloc, xrealloc, xfree e$B$Oe(B GVL
e$B$J$/$F$b8F$Y$k$Y$-$@$m$&!$$H$$$&$3$H$K$Je(B
e$B$j$^$7$?!%e(B

e$B!!e(Bxmalloc, xrealloc, xfree e$B$O!$e(Bruby
e$B$H$O4X78$J$$%W%m%0%i%`$+$i$b!$!VJVCMe(B
e$B$r5$$K$7$J$/$F$b$h$$%a%b%j4IM}4X?t!W$G$"$k$Y$-$G!$e(Bruby
e$B$H$O4X78$J$/$F$be(B
e$BF0$/$Y$-$@$m$&!$$H$$$&5DO@$K$h$j$^$9!%e(B

e$B!!$H$$$&$o$1$G!$0J2<$N$h$&$K?6$kIq$&$h$&$K$7$^$7$?!%e(B

(1) GVL e$B3MF@Cf$O=>MhDL$je(B
(2) GVL e$B$J$$$H$-$K!$e(BGC e$B$b$7$/$Oe(B NoMemoryError e$BH/@8e(B
(2.1) ruby e$B%9%l%C%I$@$C$?$i!$e(BGVL e$B$r3MF@$7$F$=$l$i$re(B
(2.2) ruby e$B%9%l%C%I$G$J$1$l$Pe(B stderr e$B$Ke(B exit(1)

e$B!!$H$$$&$o$1$G!$85!9$NLdBj!Je(B[ruby-dev:37383]e$B!K$O2r7h$G$-$?$+$H;W$$$^$9!%e(B

e$B$I$&$G$7$g$&$+!d$&$5$5$se(B

e$B!!$=$l$O$=$l$H$7$F!$e(Brb_thread_call_with_gvl()
e$B$N$h$&$J4X?t$OI,MW$G$O$J$$e(B
e$B$+!$$H;W$$$^$9$N$G!$$H$j$"$($:e(B experimental
e$B$H%3%a%s%H$7$FDI2C$7$F$*$-$^e(B
e$B$7$?!%e(B

e$B!!$3$l$i$N=$@5!Je(Br21438e$B!$e(Br21441e$B!K$Oe(B1.9.1
e$B$K$b!$%3%_%C%H$7$F$$$?$@$1$k$H$he(B
e$B$$$+$H;W$&$N$G$9$,!$$$$+$,$G$7$g$&$+!de(Byuguie$B$5$se(B


#3

On 1/12/09 1:19 PM, SASADA Koichi wrote:

e$B!!$3$l$i$N=$@5!Je(Br21438e$B!$e(Br21441e$B!K$Oe(B1.9.1 e$B$K$b!$%3%_%C%H$7$F$$$?$@$1$k$H$he(B
e$B$$$+$H;W$&$N$G$9$,!$$$$+$,$G$7$g$&$+!de(Byuguie$B$5$se(B

e$B$&!<$s!#@7WJQ99$G$O$"$j$^$9$1$l$I$b!"e(B[ruby-dev:37383]e$B$,$i$$J$i;EJ}$J$$e(B
e$B$G$9$h$M!#%^!<%8$7$^$7$?!#e(B


#4

e$B$3$s$K$A$O!"$J$+$`$ie(B(e$B$&e(B)e$B$G$9!#e(B

In message “[ruby-dev:37761] Re: [BUG:trunk] Re: [ruby-cvs:28403]
Ruby:r21185 (trunk): * thread.c (rb_thread_blocking_region): add a
comment.”
on Jan.12,2009 13:19:50, removed_email_address@domain.invalid wrote:

e$B!!$H$$$&$o$1$G!$85!9$NLdBj!Je(B[ruby-dev:37383]e$B!K$O2r7h$G$-$?$+$H;W$$$^$9!%e(B

e$B$I$&$G$7$g$&$+!d$&$5$5$se(B

e$B$h$5$=$&$J5$$,$9$k$N$G!"85!9$NLdBje(B([ruby-dev:37383]e$B$8$c$J$/$Fe(B
[ruby-core:19946])e$B$r=$@5$9$k%Q%C%A$r%3%_%C%H$7$^$7$?!#e(B

e$B$=$l$G$O!#e(B