Thread#wakeup not working
-------------------------
Key: JRUBY-3740
URL: http://jira.codehaus.org/browse/JRUBY-3740
Project: JRuby
Issue Type: Bug
Components: Core Classes/Modules
Affects Versions: JRuby 1.3
Environment: jruby 1.3.0 (ruby 1.8.6p287) (2009-06-03 5dc2e22)
(OpenJDK Client VM 1.6.0_0) [i386-java]
java version "1.6.0_0"
OpenJDK Runtime Environment (IcedTea6 1.5) (fedora-18.b16.fc10-i386)
OpenJDK Client VM (build 14.0-b15, mixed mode)
Reporter: TwP
Priority: Blocker
Thread#wakeup does not appear to be working in JRuby 1.3.0
$> cat test.rb
STDOUT.sync = true
Thread.abort_on_exception = true
t = Thread.new {
start = Time.now
loop {
puts 'sleeping'
sleep 5
puts "wake up [#{Time.now-start}]"
break if Thread.current[:stop]
}
}
sleep 0.3
puts 'stopping'
t[:stop] = true
t.wakeup.join
$> jruby test.rb
sleeping
stopping
wake up [5.015]
$> ruby test.rb
sleeping
stopping
wake up [0.300945]
The output from the second run is what I would expect JRuby to produce as well.
The wakeup call to the other thread is not causing it to break out of the sleep
statement. So we just sit there till the full 5 second sleep time has elapsed
(instead of waking up immediately and then breaking out of the loop).
Thanks for JRuby!
Blessings,
TwP
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email