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.
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?
_why