Method: Session::Request#initialize
- Defined in:
- lib/jiji/util/block_to_session.rb
#initialize(block) ⇒ Request
Returns a new instance of Request.
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/jiji/util/block_to_session.rb', line 38 def initialize( block ) @mutex = Mutex.new @cv = ConditionVariable.new @finished = false @value = nil @error = nil @proc = proc {|*args| begin @value = block.call(*args) rescue Exception @error = $! ensure @mutex.synchronize{ @finished = true @cv.signal } end } end |