Module: CSP
- Defined in:
- lib/csp.rb,
lib/csp/skip.rb,
lib/csp/choice.rb,
lib/csp/channel.rb,
lib/csp/process.rb,
lib/csp/scheduler.rb
Defined Under Namespace
Classes: Channel, Process, SKIP, Scheduler
Class Method Summary
collapse
Class Method Details
.enqueue(cont) ⇒ Object
32
33
34
|
# File 'lib/csp.rb', line 32
def enqueue(cont)
scheduler.enqueue(cont)
end
|
.run ⇒ Object
28
29
30
|
# File 'lib/csp.rb', line 28
def run
scheduler.run
end
|
.scheduler ⇒ Object
12
13
14
|
# File 'lib/csp.rb', line 12
def scheduler
@scheduler ||= CSP::Scheduler.new
end
|
.select(*options) ⇒ Object
4
5
6
7
8
9
10
11
|
# File 'lib/csp/choice.rb', line 4
def self.select(*options)
callcc do |cont|
options.each do |option|
option.read(:callback => cont)
end
CSP.run
end
end
|
.start(*processes) ⇒ Object
16
17
18
19
20
21
22
|
# File 'lib/csp.rb', line 16
def start(*processes)
processes.each do |process|
process.start
end
CSP.run
end
|
.yield ⇒ Object
24
25
26
|
# File 'lib/csp.rb', line 24
def yield
scheduler.yield
end
|