Hi,

In message "Re: sandbox timers & block scopes"
    on Wed, 9 Aug 2006 03:09:32 +0900, why the lucky stiff <ruby-core / whytheluckystiff.net> writes:

|Two puzzles I am trying to solve:
|
|1. Ruby uses setitimer to switch threads.  I would like to use setitimer as well
|to abort a sandbox which runs longer than its timeout.  Can anyone recommend a
|signal which can be used for this?  Or could I get access to the thread
|switching routine so I can check sandbox timeouts between threads?  Or, perhaps
|there is another strategy.

I think you've solved this one.

|2. Block scopes are causing me some trouble since they have mixed scope.
|
|     3.times do |i|
|       Sandbox.safe.eval("local_variables")  #=> ['i']
|     end
|
|Method scopes, on the other hand, work fine.
|
|     def box_eval(str)
|       i = 1
|       Sandbox.safe.eval(str)
|     end
|     box_eval("local_variables")  #=> []
|
|When eval is called, I swap out ruby_scope for a new, blank struct SCOPE.
|Do I need to replace ruby_block and ruby_frame as well?

You have to replace ruby_dyna_vars for in-block local variables,
ruby_frame and ruby_block for blocks.

							matz.