Class: CSP::Process

Inherits:
Object
  • Object
show all
Defined in:
lib/csp/process.rb

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ Process

Returns a new instance of Process.



7
8
9
# File 'lib/csp/process.rb', line 7

def initialize(&block)
  @block = block
end

Instance Method Details

#callObject



11
12
13
# File 'lib/csp/process.rb', line 11

def call
  @block.call
end

#startObject



15
16
17
18
19
20
# File 'lib/csp/process.rb', line 15

def start
  callcc do |cont|
    CSP.enqueue(cont)
    @block.call
  end
end