Sha256: 77f573694dd957e400ea4ef1b57f83e519b1de2a43849d57f2a7dc8cf76b756b
Contents?: true
Size: 1.13 KB
Versions: 3
Compression:
Stored size: 1.13 KB
Contents
class CodeEvaluation class << self def wait_for_eval_thread(&block) eval_thread = Thread.start do value_proc = Proc.new do if Maglev::System.__DBEPersistenceMode Maglev.persistent do block.call end else Maglev.transient do block.call end end end value_proc.__call_and_rescue do |eval_result| is_exception = eval_result[0] if is_exception Thread.current.__set_exception(eval_result[1]) eval_result[1] = Thread.current else Thread.current.__set_exception(nil) end Thread.current[:result] = eval_result Thread.current[:manual_stop] = true if is_exception Thread.stop Thread.current[:manual_stop] = false eval_result[1].__exception.__resume end end Thread.current[:manual_stop] = true end sleep 0.1 until eval_thread.stop? and eval_thread[:manual_stop] result = eval_thread[:result] return result end end end
Version data entries
3 entries across 3 versions & 1 rubygems