Created
June 11, 2010 17:55
-
-
Save p/434818 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'ruote' | |
# preparing the engine | |
$engine = Ruote::Engine.new( | |
Ruote::Worker.new( | |
Ruote::HashStorage.new)) | |
$child = Ruote.process_definition :name => 'child' do | |
participant :child | |
end | |
pdef = Ruote.process_definition :name => 'test' do | |
participant :parent | |
end | |
$engine.register_participant :parent do |wi| | |
puts 'parent' | |
$engine.launch($child) | |
$engine.launch($child) | |
$engine.launch($child) | |
end | |
$engine.register_participant :child do |wi| | |
# use sleep for wait_for difference demonstration, below | |
sleep 0.1 | |
puts 'child' | |
# generate an exception | |
# comment this line to have the program terminate | |
bogus | |
end | |
# launching, creating a process instance | |
wfid = $engine.launch(pdef) | |
# this wait_for terminates program before children can run | |
#$engine.wait_for(wfid) | |
$engine.wait_for(:empty) | |
p 'end' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment