Project

General

Profile

Actions

Bug #1169

closed

Thread#priority still doesn't work

Added by lucas (Lucas Nussbaum) almost 16 years ago. Updated over 13 years ago.

Status:
Closed
Target version:
ruby -v:
1.9.1p0
Backport:
[ruby-core:22208]

Description

=begin
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
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0