D
Daniel Merk
[Note: parts of this message were removed to make it a legal post.]
Hello together,
I am using the following Ruby version:
ruby 1.8.7 (2008-08-11 patchlevel 72) [i386-cygwin]
I have problems with threads now that did not occur in Ruby 1.8.6. I execute
the following code (derived from an
example in the Ruby core documentation):
require 'thread'
count1 = count2 = 0
puts "starting thread a"
a = Thread.new do
loop { count1 += 1 }
end
a.priority = -1
puts "starting thread b"
b = Thread.new do
loop { count2 += 1 }
end
b.priority = -2
sleep 1 #=> 1
Thread.critical = 1
puts "count1: #{count1}"
puts "count2: #{count2}"
This code never starts thread b. It seems that thread a blocks all
other threads once it runs (though its priority is lowered), even the
main thread.
If I put a sleep command into the thread a loop, thread b starts, but
the problem remains, since then thread b blocks all others from
running.
The Ruby 1.8.7 release notes speak of a change in the mutex
implementation in C. Could that be a problem?
Thanks for any help
Daniel
Hello together,
I am using the following Ruby version:
ruby 1.8.7 (2008-08-11 patchlevel 72) [i386-cygwin]
I have problems with threads now that did not occur in Ruby 1.8.6. I execute
the following code (derived from an
example in the Ruby core documentation):
require 'thread'
count1 = count2 = 0
puts "starting thread a"
a = Thread.new do
loop { count1 += 1 }
end
a.priority = -1
puts "starting thread b"
b = Thread.new do
loop { count2 += 1 }
end
b.priority = -2
sleep 1 #=> 1
Thread.critical = 1
puts "count1: #{count1}"
puts "count2: #{count2}"
This code never starts thread b. It seems that thread a blocks all
other threads once it runs (though its priority is lowered), even the
main thread.
If I put a sleep command into the thread a loop, thread b starts, but
the problem remains, since then thread b blocks all others from
running.
The Ruby 1.8.7 release notes speak of a change in the mutex
implementation in C. Could that be a problem?
Thanks for any help
Daniel