From: Lucas Nussbaum <redmine@...>
Date: 2009-02-18T18:22:29+09:00
Subject: [ruby-core:22208] [Bug #1169] Thread#priority still doesn't work

Bug #1169: Thread#priority still doesn't work
http://redmine.ruby-lang.org/issues/show/1169

Author: Lucas Nussbaum
Status: Open, Priority: Normal
ruby -v: 1.9.1p0

Hi,

In [ruby-dev:33124], it was reported that Thread#priority didn't work properly. Apparently, it still doesn't work: test_priority still randomly fails during 'make tests-all'.

Example script:
c1 = c2 = 0
t1 = Thread.new { loop { c1 += 1 } }
t1.priority = -1
t2 = Thread.new { loop { c2 += 1 } }
t2.priority = -3
sleep 5
t1.kill
t2.kill
puts "#{c1} #{c2} #{c1 > c2}"

Output:
$ while true; do ruby1.9 t.rb ; done
38282412 29165036 true
62366432 412710 true
11895940 263708221 false
24823756 62805923 false
5256995 68944142 false
49038072 14617852 true
47802027 28211284 true
17908514 62888354 false
36634663 68310354 false
24960080 39373933 false


----------------------------------------
http://redmine.ruby-lang.org