Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Deadlock in eval when $SAFE>=4

Reply
Thread Tools

Deadlock in eval when $SAFE>=4

 
 
Michael Witrant
Guest
Posts: n/a
 
      04-28-2004
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.
 
Reply With Quote
 
 
 
 
Robert Klemme
Guest
Posts: n/a
 
      04-28-2004

"Michael Witrant" <(E-Mail Removed)> schrieb im Newsbeitrag
news:(E-Mail Removed) om...
> 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

 
Reply With Quote
 
 
 
 
ts
Guest
Posts: n/a
 
      04-28-2004
>>>>> "R" == Robert Klemme <(E-Mail Removed)> writes:

R> .... 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





 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
to eval or not to eval? Marc Girod Perl Misc 2 04-19-2011 01:13 PM
eval('07') works, eval('08') fails, why? Alex van der Spek Python 6 01-08-2009 08:24 PM
Different behavior between eval "07" and eval "08" Liang Wang Perl Misc 8 02-02-2008 08:31 PM
DataBinder.Eval and Eval. craigkenisston@hotmail.com ASP .Net 1 06-16-2006 05:33 PM
DataBinder.Eval for an object's property property... like Eval(Container.DataItem,"Version.Major") Eric Newton ASP .Net 3 04-04-2005 10:11 PM



Advertisments