From: Chad Fowler Date: 2004-01-01T12:54:11+09:00 Subject: Re: sleep is broken with --enable-pthread [Was: Bad interaction between timeout.rb and --enable-pthread] Nathaniel Talbott wrote: > I should have reduced it more before posting... > > On Dec 31, 2003, at 15:34, Nathaniel Talbott wrote: > >> Here's a testcase that shows the problem: >> >> require 'test/unit' >> >> class TC < Test::Unit::TestCase >> def test_time > > > Thread.start{} > >> t = Time.now >> sleep(5) >> assert_in_delta(5, Time.now.to_i - t.to_i, 1) >> end >> end > > > So the problem is much more fundamental: sleep seems to not work at > all once a Ruby thread has been run if --enable-pthread is used. Any > ideas? > > Thanks, > > > Nathaniel > > <:((>< > Looks like the select() call in rb_thread_wait_for is being interrupted early with errno == EINT, but only if a Thread has been started prior to the call to sleep(). This appears to be caused by matz's change on Dec. 13 to eval.c (1.605) in response to [ruby-talk:87519]. That's as far as I can go I guess. I don't know how to solve the problem. I wish I understood this all better. Anyone want to do a brief explanation after the bug is fixed? ;) Happy New Year, Chad