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, [email protected] 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, ®ion->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, ®ion->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