Sha256: a802537d78c7b26a0f77d1ec5abdeac98816de5751aa6bc3954f9512e9d91afd
Contents?: true
Size: 926 Bytes
Versions: 2
Compression:
Stored size: 926 Bytes
Contents
class CodeEvaluation class << self def wait_for_eval_thread(&block) eval_thread = Thread.start do value_proc = Proc.new(&block) 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
maglev-database-explorer-0.0.2 | lib/maglev-database-explorer/code_evaluation.rb |
maglev-database-explorer-0.0.1 | lib/maglev-database-explorer/code_evaluation.rb |