Hi,
In message "[ruby-talk:03084] Re: Thread priorities"
on 00/06/01, Dave Thomas <Dave / thomases.com> writes:
|> No, there was a bug. But when the bug is fixed this program hangs,
|> since thread b goes to inifinite loop with higher priority. There's
|> no chance for other threads to run.
|
|But if I change it to:
|
| Thread.current.priority = 2
| b.priority = 1
| sleep 1
|
|would it run? And if so, would the c1 be zero at the end?
By fixed interpreter:
c1 = 0
c2 = 0
a = Thread.new do
loop { c1 += 1 }
end
b = Thread.new do
Thread.current.priority = -1
loop { c2 += 1 }
end
sleep 1
p c1 # => 157325
p c2 # => 0
Is this fine?
matz.