Hey guys,I've been trying to timeout infinite loops for the past days and can't find a way around this problem.The last post concerning this topic is almost 2 years old and got me nowhere,so i was wondering if there is any new way to approach this problem?I had a good look at the specs, but as they are pending, I'm really at wit's end.Any help would be appreciated.– jbr--
You received this message because you are subscribed to the Google Groups "The Ruby Racer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to therubyracer...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
V8::C::Locker::StartPreemption(2)
@result = nil
@thread_id = nil
Thread.new do
loop until @thread_id
logger.info "thread id: #{@thread_id}"
V8::C::Locker() do
V8::C::V8::TerminateExecution(@thread_id)
end
end
Thread.new do
V8::C::Locker() do
@thread_id = V8::C::V8::GetCurrentThreadId()
V8::Context.new {|cxt| @result = cxt.eval('for(var i=0;i<999999999;i++) { 1 + 1 }')}
end
end
sleep 1
render :text => "Result: #{@result}"
Started GET "/test" for 127.0.0.1 at 2013-03-02 13:28:03 +0100
Processing by TestController#test as HTML
thread id: 5
Rendered text template (0.0ms)
Completed 200 OK in 4877ms (Views: 1.5ms)
--