mike5
(mike)
1
The following code produces a deadlock:
$ cat test.rb
def foo bar = nil; end
Thread.new { $SAFE=4; eval(“foo foo foo”) }.value
$ ruby18 -v test.rb
ruby 1.8.1 (2003-12-25) [i686-linux]
test.rb:2:in `value’: Thread(0x401d1900): deadlock (fatal)
from test.rb:2
It works well when $SAFE <= 3 or when the number of “foo” is <= 2.
Robert
(Robert)
2
“Michael Witrant” mike.pub@lepton.fr schrieb im Newsbeitrag
news:8248e2a3.0404280713.17ae835b@posting.google.com…
The following code produces a deadlock:
$ cat test.rb
def foo bar = nil; end
Thread.new { $SAFE=4; eval(“foo foo foo”) }.value
$ ruby18 -v test.rb
ruby 1.8.1 (2003-12-25) [i686-linux]
test.rb:2:in `value’: Thread(0x401d1900): deadlock (fatal)
from test.rb:2
Funny…
It works well when $SAFE <= 3 or when the number of “foo” is <= 2.
… or when the string is syntactically correct:
Thread.new { $SAFE=4; eval(“foo; foo; foo”) }.value
robert
ts1
(ts)
3
.... or when the string is syntactically correct:
It want to send a message
warning: parenthesize argument(s) for future version
because it run with $SAFE >= 4, it can't write ==> this stop the compile
phase, which has set `rb_thread_critical = Qtrue'
When it want to call Thread#value, it call Thread#join and because
rb_thread_critical = Qtrue (it was not reset to Qfalse)
it give the error deadlock
Guy Decoux