dramatis 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +7 -0
- data/License.txt +20 -0
- data/Manifest.txt +119 -0
- data/README.txt +57 -0
- data/Rakefile +4 -0
- data/config/hoe.rb +70 -0
- data/config/requirements.rb +17 -0
- data/examples/README.txt +20 -0
- data/examples/auction.rb +90 -0
- data/examples/bank/bank.rb +7 -0
- data/examples/bank/bank_test.rb +7 -0
- data/examples/exception.rb +40 -0
- data/examples/fib/conservative.rb +50 -0
- data/examples/fib/future.rb +5 -0
- data/examples/fib/original.rb +33 -0
- data/examples/fib/threads.rb +51 -0
- data/examples/im/distributed/chat/client.rb +49 -0
- data/examples/im/distributed/chat/screen/fox.rb +92 -0
- data/examples/im/distributed/chat/screen.rb +11 -0
- data/examples/im/distributed/chat/server.rb +72 -0
- data/examples/im/distributed/chat.rb +5 -0
- data/examples/im/distributed/client.rb +9 -0
- data/examples/im/distributed/run.rb +18 -0
- data/examples/im/distributed/server.rb +11 -0
- data/examples/im/single/chat/client.rb +50 -0
- data/examples/im/single/chat/screen/fox.rb +96 -0
- data/examples/im/single/chat/screen/wxs.rb +63 -0
- data/examples/im/single/chat/screen.rb +11 -0
- data/examples/im/single/chat/server.rb +72 -0
- data/examples/im/single/chat.rb +5 -0
- data/examples/im/single/fox.rb +18 -0
- data/examples/im/single/wxchat.rb +19 -0
- data/examples/pingpong/actor.rb +33 -0
- data/examples/pingpong/actor_rec.rb +34 -0
- data/examples/pingpong/pingpong.txt +315 -0
- data/examples/pingpong/scala.rb +41 -0
- data/examples/pingpong/serial.rb +26 -0
- data/examples/pretty.txt +108 -0
- data/examples/telephone/.irbrc +2 -0
- data/examples/telephone/3esl.txt +21877 -0
- data/examples/telephone/fifth/kid.rb +36 -0
- data/examples/telephone/fifth/run.rb +26 -0
- data/examples/telephone/first/kid.rb +31 -0
- data/examples/telephone/first/run.rb +20 -0
- data/examples/telephone/fourth/kid.rb +31 -0
- data/examples/telephone/fourth/run.rb +26 -0
- data/examples/telephone/mangler.rb +53 -0
- data/examples/telephone/second/kid.rb +26 -0
- data/examples/telephone/second/run.rb +20 -0
- data/examples/telephone/seventh/kid.rb +40 -0
- data/examples/telephone/seventh/run.rb +35 -0
- data/examples/telephone/seventh/test.rb +28 -0
- data/examples/telephone/seventh/test2.rb +10 -0
- data/examples/telephone/sixth/kid.rb +39 -0
- data/examples/telephone/sixth/run.rb +26 -0
- data/examples/telephone/third/kid.rb +31 -0
- data/examples/telephone/third/run.rb +21 -0
- data/lib/dramatis/actor/interface.rb +118 -0
- data/lib/dramatis/actor/name/interface.rb +128 -0
- data/lib/dramatis/actor/name.rb +44 -0
- data/lib/dramatis/actor.rb +96 -0
- data/lib/dramatis/deadlock.rb +123 -0
- data/lib/dramatis/error/uncaught.rb +19 -0
- data/lib/dramatis/error.rb +125 -0
- data/lib/dramatis/future/interface.rb +45 -0
- data/lib/dramatis/future.rb +32 -0
- data/lib/dramatis/runtime/actor/main.rb +3 -0
- data/lib/dramatis/runtime/actor.rb +294 -0
- data/lib/dramatis/runtime/gate.rb +244 -0
- data/lib/dramatis/runtime/scheduler.rb +374 -0
- data/lib/dramatis/runtime/task.rb +390 -0
- data/lib/dramatis/runtime/thread_pool.rb +149 -0
- data/lib/dramatis/runtime/timer.rb +5 -0
- data/lib/dramatis/runtime.rb +129 -0
- data/lib/dramatis/shoes/runtime.rb +7 -0
- data/lib/dramatis/shoes.rb +14 -0
- data/lib/dramatis/version.rb +8 -0
- data/lib/dramatis.rb +73 -0
- data/log/debug.log +0 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/script/txt2html +74 -0
- data/setup.rb +1585 -0
- data/spec/dramatis/actor/become_spec.rb +17 -0
- data/spec/dramatis/actor/future_spec.rb +189 -0
- data/spec/dramatis/actor/name_spec.rb +141 -0
- data/spec/dramatis/actor/task_spec.rb +75 -0
- data/spec/dramatis/actor_spec.rb +492 -0
- data/spec/dramatis/dramatis_spec.rb +23 -0
- data/spec/dramatis/exc_spec.rb +78 -0
- data/spec/dramatis/runtime/gate_spec.rb +57 -0
- data/spec/dramatis/runtime/thread_pool.rb +30 -0
- data/spec/dramatis/shoes_spec.rb +11 -0
- data/spec/dramatis/simple_spec.rb +32 -0
- data/spec/exp_spec.rb +21 -0
- data/spec/simple2_spec.rb +36 -0
- data/spec/simple_spec.rb +30 -0
- data/spec/spec.opts +0 -0
- data/spec/spec_helper.rb +26 -0
- data/spec/thread_spec.rb +13 -0
- data/tasks/deployment.rake +34 -0
- data/tasks/environment.rake +7 -0
- data/tasks/rspec.rake +21 -0
- data/tasks/website.rake +17 -0
- data/test/jruby_lm.rb +13 -0
- data/test/test.rb +19 -0
- data/test/test10.rb +43 -0
- data/test/test11.rb +45 -0
- data/test/test12.rb +60 -0
- data/test/test13.rb +71 -0
- data/test/test2.rb +12 -0
- data/test/test3.rb +10 -0
- data/test/test4.rb +29 -0
- data/test/test5.rb +8 -0
- data/test/test6.rb +32 -0
- data/test/test7.rb +48 -0
- data/test/test8.rb +133 -0
- data/test/test9.rb +105 -0
- data/test/test_exc.rb +22 -0
- metadata +180 -0
data/spec/exp_spec.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
describe "ruby" do
|
2
|
+
|
3
|
+
it "should work" do
|
4
|
+
|
5
|
+
module Simple2M
|
6
|
+
|
7
|
+
class Wrapper
|
8
|
+
def initialize wrapped
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.included cls
|
13
|
+
class << cls
|
14
|
+
def new
|
15
|
+
Wrapper.new super
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
class Simple2C; include Simple2M; end
|
23
|
+
|
24
|
+
Simple2C.new.should be_kind_of( Simple2M::Wrapper )
|
25
|
+
|
26
|
+
class Simple2C
|
27
|
+
class << self
|
28
|
+
remove_method :new
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
Simple2C.new.should be_kind_of( Simple2C )
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
data/spec/simple_spec.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
describe "ruby" do
|
2
|
+
|
3
|
+
it "should work" do
|
4
|
+
|
5
|
+
module SimpleM
|
6
|
+
|
7
|
+
class Wrapper
|
8
|
+
def initialize wrapped
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
module Class
|
13
|
+
def new
|
14
|
+
Wrapper.new super
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.included cls
|
19
|
+
cls.extend Class
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
class SimpleC; include SimpleM; end
|
25
|
+
|
26
|
+
SimpleC.new.should be_kind_of( SimpleM::Wrapper )
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
data/spec/spec.opts
ADDED
File without changes
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
begin
|
2
|
+
require 'spec'
|
3
|
+
rescue LoadError
|
4
|
+
require 'rubygems'
|
5
|
+
gem 'rspec'
|
6
|
+
require 'spec'
|
7
|
+
end
|
8
|
+
|
9
|
+
$:.push File.join( File.dirname(__FILE__), "..", "lib" )
|
10
|
+
|
11
|
+
module DramatisSpecHelper
|
12
|
+
|
13
|
+
def runtime_check
|
14
|
+
begin
|
15
|
+
Dramatis::Runtime.current.quiesce
|
16
|
+
Dramatis::Runtime.current.exceptions.length.should equal( 0 )
|
17
|
+
Thread.list.length.should \
|
18
|
+
equal( 1 + Dramatis::Runtime::Scheduler.current.thread_count )
|
19
|
+
ensure
|
20
|
+
Dramatis::Runtime.reset
|
21
|
+
Thread.list.length.should == 1
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
data/spec/thread_spec.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
desc 'Release the website and new gem version'
|
2
|
+
task :deploy => [:check_version, :website, :release] do
|
3
|
+
puts "Remember to create SVN tag:"
|
4
|
+
puts "svn copy svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/trunk " +
|
5
|
+
"svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/tags/REL-#{VERS} "
|
6
|
+
puts "Suggested comment:"
|
7
|
+
puts "Tagging release #{CHANGES}"
|
8
|
+
end
|
9
|
+
|
10
|
+
desc 'Runs tasks website_generate and install_gem as a local deployment of the gem'
|
11
|
+
task :local_deploy => [:website_generate, :install_gem]
|
12
|
+
|
13
|
+
task :check_version do
|
14
|
+
unless ENV['VERSION']
|
15
|
+
puts 'Must pass a VERSION=x.y.z release version'
|
16
|
+
exit
|
17
|
+
end
|
18
|
+
unless ENV['VERSION'] == VERS
|
19
|
+
puts "Please update your version.rb to match the release version, currently #{VERS}"
|
20
|
+
exit
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
desc 'Install the package as a gem, without generating documentation(ri/rdoc)'
|
25
|
+
task :install_gem_no_doc => [:clean, :package] do
|
26
|
+
sh "#{'sudo ' unless Hoe::WINDOZE }gem install pkg/*.gem --no-rdoc --no-ri"
|
27
|
+
end
|
28
|
+
|
29
|
+
namespace :manifest do
|
30
|
+
desc 'Recreate Manifest.txt to include ALL files'
|
31
|
+
task :refresh do
|
32
|
+
`rake check_manifest | patch -p0 > Manifest.txt`
|
33
|
+
end
|
34
|
+
end
|
data/tasks/rspec.rake
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
begin
|
2
|
+
require 'spec'
|
3
|
+
rescue LoadError
|
4
|
+
require 'rubygems'
|
5
|
+
require 'spec'
|
6
|
+
end
|
7
|
+
begin
|
8
|
+
require 'spec/rake/spectask'
|
9
|
+
rescue LoadError
|
10
|
+
puts <<-EOS
|
11
|
+
To use rspec for testing you must install rspec gem:
|
12
|
+
gem install rspec
|
13
|
+
EOS
|
14
|
+
exit(0)
|
15
|
+
end
|
16
|
+
|
17
|
+
desc "Run the specs under spec/models"
|
18
|
+
Spec::Rake::SpecTask.new do |t|
|
19
|
+
t.spec_opts = ['--options', "spec/spec.opts"]
|
20
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
21
|
+
end
|
data/tasks/website.rake
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
desc 'Generate website files'
|
2
|
+
task :website_generate => :ruby_env do
|
3
|
+
(Dir['website/**/*.txt'] - Dir['website/version*.txt']).each do |txt|
|
4
|
+
sh %{ #{RUBY_APP} script/txt2html #{txt} > #{txt.gsub(/txt$/,'html')} }
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
desc 'Upload website files to rubyforge'
|
9
|
+
task :website_upload do
|
10
|
+
host = "#{rubyforge_username}@rubyforge.org"
|
11
|
+
remote_dir = "/var/www/gforge-projects/#{PATH}/"
|
12
|
+
local_dir = 'website'
|
13
|
+
sh %{rsync -aCv #{local_dir}/ #{host}:#{remote_dir}}
|
14
|
+
end
|
15
|
+
|
16
|
+
desc 'Generate and upload website files'
|
17
|
+
task :website => [:website_generate, :website_upload, :publish_docs]
|
data/test/jruby_lm.rb
ADDED
data/test/test.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/bin/env ruby
|
2
|
+
|
3
|
+
$:.push File.join( File.dirname(__FILE__), "..", "lib" )
|
4
|
+
|
5
|
+
require 'dramatis/actor/name'
|
6
|
+
require 'thread'
|
7
|
+
require 'pp'
|
8
|
+
|
9
|
+
begin
|
10
|
+
Dramatis::Actor.new.foo
|
11
|
+
raise "hell"
|
12
|
+
rescue Dramatis::Deadlock => e
|
13
|
+
# puts "got expected #{e}"
|
14
|
+
end
|
15
|
+
# pp Thread.list
|
16
|
+
Dramatis::Runtime.current.quiesce
|
17
|
+
# pp Thread.list
|
18
|
+
raise "hell" if Thread.list.length > 1
|
19
|
+
|
data/test/test10.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
#!/bin/env ruby
|
2
|
+
|
3
|
+
$:.push File.join( File.dirname(__FILE__), "..", "lib" )
|
4
|
+
|
5
|
+
require 'dramatis/actor/name'
|
6
|
+
require 'dramatis/runtime'
|
7
|
+
|
8
|
+
require 'pp'
|
9
|
+
|
10
|
+
a = Class.new do
|
11
|
+
|
12
|
+
include Dramatis::Actor
|
13
|
+
|
14
|
+
def a
|
15
|
+
p "b4b"
|
16
|
+
begin
|
17
|
+
actor.name.b
|
18
|
+
rescue Exception => e
|
19
|
+
p "got a #{e}"
|
20
|
+
raise e
|
21
|
+
end
|
22
|
+
p "a4b"
|
23
|
+
end
|
24
|
+
|
25
|
+
def b
|
26
|
+
p "bbb"
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
# non-call threaded
|
32
|
+
# This should deadlock nicely
|
33
|
+
|
34
|
+
begin
|
35
|
+
p "b4"
|
36
|
+
a.new.a
|
37
|
+
p "a4"
|
38
|
+
raise "should have deadlocked"
|
39
|
+
rescue Dramatis::Deadlock
|
40
|
+
p "got it. yeah!"
|
41
|
+
end
|
42
|
+
|
43
|
+
p "done"
|
data/test/test11.rb
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
#!/bin/env ruby
|
2
|
+
|
3
|
+
$:.push File.join( File.dirname(__FILE__), "..", "lib" )
|
4
|
+
|
5
|
+
require 'dramatis/actor/name'
|
6
|
+
require 'dramatis/actor'
|
7
|
+
require 'dramatis/runtime'
|
8
|
+
|
9
|
+
require 'pp'
|
10
|
+
|
11
|
+
# call threading test
|
12
|
+
|
13
|
+
a = Class.new do
|
14
|
+
|
15
|
+
include Dramatis::Actor
|
16
|
+
|
17
|
+
def initialize
|
18
|
+
actor.enable_call_threading
|
19
|
+
end
|
20
|
+
|
21
|
+
def a
|
22
|
+
actor.name.b
|
23
|
+
end
|
24
|
+
|
25
|
+
def b
|
26
|
+
end
|
27
|
+
|
28
|
+
def c
|
29
|
+
other = self.class.new
|
30
|
+
other.d actor.name
|
31
|
+
end
|
32
|
+
|
33
|
+
def d first
|
34
|
+
first.a
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
# recursion allowd
|
40
|
+
|
41
|
+
a.new.a
|
42
|
+
|
43
|
+
# co-recursion allowed
|
44
|
+
|
45
|
+
a.new.c
|
data/test/test12.rb
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
#!/bin/env ruby
|
2
|
+
|
3
|
+
$:.push File.join( File.dirname(__FILE__), "..", "lib" )
|
4
|
+
|
5
|
+
require 'dramatis/actor/name'
|
6
|
+
require 'dramatis/runtime'
|
7
|
+
|
8
|
+
require 'pp'
|
9
|
+
|
10
|
+
include Dramatis
|
11
|
+
|
12
|
+
a = Class.new do
|
13
|
+
|
14
|
+
include Dramatis::Actor
|
15
|
+
|
16
|
+
attr_reader :block_called
|
17
|
+
|
18
|
+
def initialize
|
19
|
+
actor.refuse :c
|
20
|
+
actor.always :block_called, true
|
21
|
+
end
|
22
|
+
|
23
|
+
def a other
|
24
|
+
block = lambda do |c|
|
25
|
+
# warn "block continuation #{c}"
|
26
|
+
@block_called = true
|
27
|
+
end
|
28
|
+
( interface( other ).continue( &block ) ).b
|
29
|
+
other.c
|
30
|
+
end
|
31
|
+
|
32
|
+
def enable
|
33
|
+
actor.default :c
|
34
|
+
end
|
35
|
+
|
36
|
+
def b
|
37
|
+
end
|
38
|
+
|
39
|
+
def c
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
# non-call threaded
|
45
|
+
|
46
|
+
a1 = a.new
|
47
|
+
a2 = a.new
|
48
|
+
( interface( a1 ).continue nil ).a a2
|
49
|
+
|
50
|
+
Dramatis::Runtime.current.quiesce
|
51
|
+
|
52
|
+
raise "hell" if a1.block_called
|
53
|
+
|
54
|
+
a2.enable
|
55
|
+
|
56
|
+
Dramatis::Runtime.current.quiesce
|
57
|
+
|
58
|
+
raise "hell" if !a1.block_called
|
59
|
+
|
60
|
+
|
data/test/test13.rb
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
#!/bin/env ruby
|
2
|
+
|
3
|
+
$:.push File.join( File.dirname(__FILE__), "..", "lib" )
|
4
|
+
|
5
|
+
require 'dramatis/actor/name'
|
6
|
+
require 'dramatis/runtime'
|
7
|
+
|
8
|
+
require 'pp'
|
9
|
+
|
10
|
+
include Dramatis
|
11
|
+
|
12
|
+
a = Class.new do
|
13
|
+
|
14
|
+
include Dramatis::Actor
|
15
|
+
|
16
|
+
attr_reader :block_called, :exception_raised
|
17
|
+
|
18
|
+
def initialize
|
19
|
+
actor.refuse :c
|
20
|
+
actor.always :block_called, true
|
21
|
+
actor.always :exception_raised, true
|
22
|
+
end
|
23
|
+
|
24
|
+
def a other
|
25
|
+
result = lambda do |r|
|
26
|
+
# warn "block continuation #{r}"
|
27
|
+
@block_called = true
|
28
|
+
end
|
29
|
+
except = lambda do |exception|
|
30
|
+
# warn "#{exception} (a good thing)"
|
31
|
+
raise "hell: #{exception.to_s}" if exception.to_s != "hell"
|
32
|
+
# warn "exception continuation"
|
33
|
+
@exception_raised = true
|
34
|
+
end
|
35
|
+
( interface( other ).continue :exception => except, &result ).bb
|
36
|
+
( interface( other ).continue :exception => except, &result ).b
|
37
|
+
other.c
|
38
|
+
end
|
39
|
+
|
40
|
+
def enable
|
41
|
+
actor.default :c
|
42
|
+
end
|
43
|
+
|
44
|
+
def bb
|
45
|
+
end
|
46
|
+
|
47
|
+
def b
|
48
|
+
raise "hell"
|
49
|
+
end
|
50
|
+
|
51
|
+
def c
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
# non-call threaded
|
57
|
+
|
58
|
+
a1 = a.new
|
59
|
+
a2 = a.new
|
60
|
+
( interface( a1 ).continue nil ).a a2
|
61
|
+
|
62
|
+
Dramatis::Runtime.current.quiesce
|
63
|
+
|
64
|
+
raise "hell" if a1.block_called
|
65
|
+
raise "hell" if !a1.exception_raised
|
66
|
+
|
67
|
+
a2.enable
|
68
|
+
|
69
|
+
Dramatis::Runtime.current.quiesce
|
70
|
+
|
71
|
+
raise "hell" if !a1.block_called
|
data/test/test2.rb
ADDED
data/test/test3.rb
ADDED
data/test/test4.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/bin/env ruby
|
2
|
+
|
3
|
+
$:.push File.join( File.dirname(__FILE__), "..", "lib" )
|
4
|
+
|
5
|
+
require 'dramatis/actor/name'
|
6
|
+
require 'dramatis/runtime'
|
7
|
+
|
8
|
+
include Dramatis
|
9
|
+
|
10
|
+
require 'pp'
|
11
|
+
|
12
|
+
class Foo
|
13
|
+
include Dramatis::Actor
|
14
|
+
def foo arg
|
15
|
+
raise "hell" if arg != :bar
|
16
|
+
:foobar
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
actor = Foo.new
|
21
|
+
|
22
|
+
result = nil
|
23
|
+
retval = ( interface( actor ).continue {|value| result = value } ).foo :bar
|
24
|
+
|
25
|
+
raise "hell: [#{retval.inspect}]" if retval != nil
|
26
|
+
|
27
|
+
Dramatis::Runtime.current.quiesce
|
28
|
+
|
29
|
+
raise "hell: [#{result.inspect}]" if result != :foobar
|
data/test/test5.rb
ADDED
data/test/test6.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
#!/bin/env ruby
|
2
|
+
|
3
|
+
$:.push File.join( File.dirname(__FILE__), "..", "lib" )
|
4
|
+
|
5
|
+
require 'dramatis/actor/name'
|
6
|
+
require 'dramatis/runtime'
|
7
|
+
|
8
|
+
require 'pp'
|
9
|
+
|
10
|
+
cls = Class.new do
|
11
|
+
include Dramatis::Actor
|
12
|
+
|
13
|
+
def rpc other
|
14
|
+
warn "e"
|
15
|
+
other.foo
|
16
|
+
warn "f"
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
a = cls.new
|
22
|
+
b = cls.new
|
23
|
+
|
24
|
+
begin
|
25
|
+
a.rpc b
|
26
|
+
raise "hell"
|
27
|
+
rescue NoMethodError
|
28
|
+
rescue Exception => e
|
29
|
+
warn "!! #{e}"
|
30
|
+
raise e
|
31
|
+
end
|
32
|
+
|
data/test/test7.rb
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
#!/bin/env ruby
|
2
|
+
|
3
|
+
$:.push File.join( File.dirname(__FILE__), "..", "lib" )
|
4
|
+
|
5
|
+
require 'dramatis/actor/name'
|
6
|
+
require 'dramatis/runtime'
|
7
|
+
|
8
|
+
require 'pp'
|
9
|
+
|
10
|
+
include Dramatis
|
11
|
+
|
12
|
+
a = Class.new do
|
13
|
+
|
14
|
+
include Dramatis::Actor
|
15
|
+
|
16
|
+
def initialize
|
17
|
+
actor.refuse :fromB
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
b = Class.new do
|
23
|
+
|
24
|
+
include Dramatis::Actor
|
25
|
+
|
26
|
+
def initialize anA
|
27
|
+
@anA = anA
|
28
|
+
end
|
29
|
+
|
30
|
+
def startB
|
31
|
+
@anA.fromB
|
32
|
+
end
|
33
|
+
|
34
|
+
def shouldDeadlock
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
anA = a.new
|
40
|
+
aB = b.new anA
|
41
|
+
|
42
|
+
( interface( aB ).continue nil ).startB
|
43
|
+
|
44
|
+
warn "b4"
|
45
|
+
# Dramatis::Runtime.current.quiesce
|
46
|
+
warn "a5"
|
47
|
+
|
48
|
+
warn "expect a final deadlock"
|