[Bug:trunk] Failure: test_priority (TestThread) on mswin32

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

e$BI=Bj$NDL$j$G$9$,!"e(Bprioritye$B$NDc$$%9%l%C%I$NA*BrN($r2<$2$k5!9=e(B
e$B$Oe(Bpthreade$B$G$be(Bwin32e$B$G$bF1$8$J$N$K!"e(Bwin32e$B$@$H$^$H$b$K5!G=$7$F$$e(B
e$B$J$$$h$&$K8+$($k$N$O$J$<$G$7$g$&$+e(B?

e$B;d$N4D6-$G<B83$7$?8B$j$@$H!"$@$$$?$$e(B30e$B!Ae(B40%e$B$/$i$$$N3NN($G$3$Ne(B
e$B%F%9%H$O<:GT$K$J$j$^$9!#e(B
e$BHyL/$K8z$$$F$$$k$h$&$J!"8z$$$F$J$/$F%9%l%C%I@8@.=g=x$K0MB8$7e(B
e$B$F$k$@$1$N$h$&$J!"HyL/$J46$8$G$9$,e(B…

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

e$B%A%1%C%He(B #812 e$B$,99?7$5$l$^$7$?!#e(B (by Yusuke E.)

e$BC4Ev<Te(B Koichi Sasadae$B$+$ie(BYusuke E.e$B$KJQ99e(B
Target version 1.9.2e$B$K%;%C%He(B
ruby -v -e$B$K%;%C%He(B

e$B1sF#$G$9!#e(B

2008e$BG/e(B12e$B7ne(B3e$BF|e(B12:46 U.Nakamura [email protected]:

e$BI=Bj$NDL$j$G$9$,!"e(Bprioritye$B$NDc$$%9%l%C%I$NA*BrN($r2<$2$k5!9=e(B
e$B$Oe(Bpthreade$B$G$be(Bwin32e$B$G$bF1$8$J$N$K!"e(Bwin32e$B$@$H$^$H$b$K5!G=$7$F$$e(B
e$B$J$$$h$&$K8+$($k$N$O$J$<$G$7$g$&$+e(B?

e$B$3$N5!9=$O!"e(Bnative_thread_yield()
e$B$r8F$s$@$H$-$K6KNOB>$N%9%l%C%I$Ke(B
e$B%3%s%F%-%9%H%9%$%C%A$7$F$/$l$J$$$HF/$-$^$;$s!#e(B
thread_win32.c e$B$G$Oe(B native_thread_yield() e$B$Oe(B Sleep(0)
e$B$H$J$C$F$$$F!"e(B
Sleep(0) e$B$Oe(B MSDN e$B$K$h$k$He(B

e$BCfCG;~4V$H$7$Fe(B 0ms e$B$r;XDj$7$F$3$N4X?t$r8F$S=P$9$H!"8=:_$N%9%l%C%I$Oe(B
e$B<+$i$K3d$jEv$F$i$l$F$$$k%?%$%`%9%i%$%9$N;D$j$NItJ,$rJ|4~$7$^$9!#e(B

e$B$i$7$$$N$G!“$3$l$,K\Ev$J$iF0$-$=$&$J$b$N$G$9$,!”$I$&$J$s$G$7$g$&$M!#e(B

e$B$$$:$l$K$7$F$b!“$3$N%F%9%H$O%W%i%C%H%U%)!<%`$H%?%$%_%s%0$K6/$/0MB8e(B
e$B$9$k$N$G$”$^$jE,@Z$G$J$+$C$?$+$b$7$l$^$;$s!#$9$G$K$J$+$@$5$s$K$h$C$Fe(B
e$B%3%a%s%H%"%&%H$5$l$F$$$k$N$G!"2r7h$7$F$$$k$H;W$$$^$9!#e(B

Thread#priority, #priority= e$B$Ne(B rdoc
e$B$O!“9bM%@hEY$N%9%l%C%I$,$$$k8B$je(B
e$BDcM%@hEY$N%9%l%C%I$,A4$/<B9T$5$l$J$$$+$N$h$&$KFI$a$k$N$G!”$3$l$r=$@5e(B
e$B$7$D$D!“%W%i%C%H%U%)!<%`$K$h$C$F$OL5;k$5$l$k$H$$$&$3$H$r=q$$$F!”$3$Ne(B
e$B%A%1%C%H$O%/%m!<%:$7$^$9!#e(B

diff --git a/thread.c b/thread.c
index 10d6047…40a3483 100644
— a/thread.c
+++ b/thread.c
@@ -2142,8 +2142,11 @@ rb_thread_keys(VALUE self)
*

  • Returns the priority of thr. Default is inherited from the
  • current thread which creating the new thread, or zero for the
    • initial main thread; higher-priority threads will run before
    • lower-priority threads.
    • initial main thread; higher-priority thread will run more
      frequently
    • than lower-priority threads (but lower-priority threads can also
      run).
    • This is just hint for Ruby thread scheduler. It may be ignored on
      some
    • platform.
    • Thread.current.priority   #=> 0
      
    */
    @@ -2162,7 +2165,11 @@ rb_thread_priority(VALUE thread)
    • thr.priority= integer   => thr
      
    • Sets the priority of thr to integer. Higher-priority
      threads
    • will run before lower-priority threads.
    • will run more frequently than lower-priority threads (but
      lower-priority
    • threads can also run).
    • This is just hint for Ruby thread scheduler. It may be ignored on
      some
    • platform.
    • count1 = count2 = 0
      
    • a = Thread.new do
      


Yusuke E. [email protected]

http://redmine.ruby-lang.org/issues/show/812

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

In message “[ruby-dev:40977] [Bug #812] Failure: test_priority
(TestThread) on mswin32”
on Apr.14,2010 00:44:30, [email protected] wrote:

e$B<+$i$K3d$jEv$F$i$l$F$$$k%?%$%`%9%i%$%9$N;D$j$NItJ,$rJ|4~$7$^$9!#e(B

e$B$i$7$$$N$G!“$3$l$,K\Ev$J$iF0$-$=$&$J$b$N$G$9$,!”$I$&$J$s$G$7$g$&$M!#e(B

e$B$b$A$m$sK\Ev$J$N$GF0$-$=$&$J$N$G$9$,!“$J$s$G$@$m$&!”$H$$$&$Ne(B
e$B$,L$$@$KFf$G$9!#e(B

Thread#priority, #priority= e$B$Ne(B rdoc e$B$O!“9bM%@hEY$N%9%l%C%I$,$$$k8B$je(B
e$BDcM%@hEY$N%9%l%C%I$,A4$/<B9T$5$l$J$$$+$N$h$&$KFI$a$k$N$G!”$3$l$r=$@5e(B
e$B$7$D$D!“%W%i%C%H%U%)!<%`$K$h$C$F$OL5;k$5$l$k$H$$$&$3$H$r=q$$$F!”$3$Ne(B
e$B%A%1%C%H$O%/%m!<%:$7$^$9!#e(B

e$B$=$l$G$$$$$H;W$$$^$9!#e(B

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