celluloid 0.12.4 → 0.13.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +3 -3
- data/lib/celluloid.rb +68 -98
- data/lib/celluloid/actor.rb +42 -22
- data/lib/celluloid/boot.rb +13 -0
- data/lib/celluloid/calls.rb +50 -8
- data/lib/celluloid/condition.rb +64 -0
- data/lib/celluloid/core_ext.rb +1 -1
- data/lib/celluloid/cpu_counter.rb +18 -0
- data/lib/celluloid/future.rb +4 -1
- data/lib/celluloid/internal_pool.rb +62 -44
- data/lib/celluloid/legacy.rb +46 -0
- data/lib/celluloid/links.rb +0 -5
- data/lib/celluloid/logger.rb +10 -4
- data/lib/celluloid/mailbox.rb +2 -1
- data/lib/celluloid/method.rb +5 -0
- data/lib/celluloid/pool_manager.rb +8 -7
- data/lib/celluloid/proxies/actor_proxy.rb +5 -8
- data/lib/celluloid/proxies/async_proxy.rb +5 -1
- data/lib/celluloid/responses.rb +8 -6
- data/lib/celluloid/stack_dump.rb +86 -0
- data/lib/celluloid/supervision_group.rb +4 -2
- data/lib/celluloid/system_events.rb +11 -0
- data/lib/celluloid/{task.rb → tasks.rb} +11 -5
- data/lib/celluloid/tasks/task_fiber.rb +11 -7
- data/lib/celluloid/tasks/task_thread.rb +18 -14
- data/lib/celluloid/thread_handle.rb +10 -6
- data/lib/celluloid/version.rb +1 -1
- data/spec/support/actor_examples.rb +118 -112
- data/spec/support/example_actor_class.rb +9 -5
- data/spec/support/task_examples.rb +2 -2
- metadata +15 -12
- data/lib/celluloid/stack_dumper.rb +0 -45
@@ -3,6 +3,7 @@ module ExampleActorClass
|
|
3
3
|
Class.new do
|
4
4
|
include included_module
|
5
5
|
attr_reader :name
|
6
|
+
finalizer :my_finalizer
|
6
7
|
|
7
8
|
def initialize(name)
|
8
9
|
@name = name
|
@@ -13,10 +14,6 @@ module ExampleActorClass
|
|
13
14
|
@name = new_name
|
14
15
|
end
|
15
16
|
|
16
|
-
def change_name_with_a_bang(new_name)
|
17
|
-
change_name! new_name
|
18
|
-
end
|
19
|
-
|
20
17
|
def change_name_async(new_name)
|
21
18
|
async.change_name new_name
|
22
19
|
end
|
@@ -55,6 +52,10 @@ module ExampleActorClass
|
|
55
52
|
inspect
|
56
53
|
end
|
57
54
|
|
55
|
+
def send(string)
|
56
|
+
string.reverse
|
57
|
+
end
|
58
|
+
|
58
59
|
def method_missing(method_name, *args, &block)
|
59
60
|
if delegates?(method_name)
|
60
61
|
@delegate.send method_name, *args, &block
|
@@ -68,7 +69,7 @@ module ExampleActorClass
|
|
68
69
|
end
|
69
70
|
|
70
71
|
def call_private
|
71
|
-
zomg_private
|
72
|
+
async.zomg_private
|
72
73
|
end
|
73
74
|
|
74
75
|
def zomg_private
|
@@ -77,6 +78,9 @@ module ExampleActorClass
|
|
77
78
|
private :zomg_private
|
78
79
|
attr_reader :private_called
|
79
80
|
|
81
|
+
def my_finalizer
|
82
|
+
end
|
83
|
+
|
80
84
|
private
|
81
85
|
|
82
86
|
def delegates?(method_name)
|
@@ -14,11 +14,11 @@ shared_context "a Celluloid Task" do |task_class|
|
|
14
14
|
subject { task_class.new(task_type) { Celluloid::Task.suspend(suspend_state) } }
|
15
15
|
|
16
16
|
before :each do
|
17
|
-
Thread.current[:
|
17
|
+
Thread.current[:celluloid_actor] = actor
|
18
18
|
end
|
19
19
|
|
20
20
|
after :each do
|
21
|
-
Thread.current[:
|
21
|
+
Thread.current[:celluloid_actor] = nil
|
22
22
|
end
|
23
23
|
|
24
24
|
it "begins with status :new" do
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: celluloid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.13.0.pre
|
5
|
+
prerelease: 7
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Tony Arcieri
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-02-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: timers
|
@@ -28,23 +28,23 @@ dependencies:
|
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: 1.0.0
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
|
-
name:
|
31
|
+
name: rake
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
33
33
|
none: false
|
34
34
|
requirements:
|
35
35
|
- - ! '>='
|
36
36
|
- !ruby/object:Gem::Version
|
37
|
-
version:
|
38
|
-
type: :
|
37
|
+
version: '0'
|
38
|
+
type: :development
|
39
39
|
prerelease: false
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
42
42
|
requirements:
|
43
43
|
- - ! '>='
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version:
|
45
|
+
version: '0'
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
|
-
name:
|
47
|
+
name: rspec
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
49
49
|
none: false
|
50
50
|
requirements:
|
@@ -60,7 +60,7 @@ dependencies:
|
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
|
-
name: rspec
|
63
|
+
name: guard-rspec
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
65
65
|
none: false
|
66
66
|
requirements:
|
@@ -103,11 +103,14 @@ files:
|
|
103
103
|
- lib/celluloid/actor.rb
|
104
104
|
- lib/celluloid/boot.rb
|
105
105
|
- lib/celluloid/calls.rb
|
106
|
+
- lib/celluloid/condition.rb
|
106
107
|
- lib/celluloid/core_ext.rb
|
108
|
+
- lib/celluloid/cpu_counter.rb
|
107
109
|
- lib/celluloid/fiber.rb
|
108
110
|
- lib/celluloid/fsm.rb
|
109
111
|
- lib/celluloid/future.rb
|
110
112
|
- lib/celluloid/internal_pool.rb
|
113
|
+
- lib/celluloid/legacy.rb
|
111
114
|
- lib/celluloid/links.rb
|
112
115
|
- lib/celluloid/logger.rb
|
113
116
|
- lib/celluloid/logging/incident.rb
|
@@ -129,13 +132,13 @@ files:
|
|
129
132
|
- lib/celluloid/responses.rb
|
130
133
|
- lib/celluloid/rspec.rb
|
131
134
|
- lib/celluloid/signals.rb
|
132
|
-
- lib/celluloid/
|
135
|
+
- lib/celluloid/stack_dump.rb
|
133
136
|
- lib/celluloid/supervision_group.rb
|
134
137
|
- lib/celluloid/supervisor.rb
|
135
138
|
- lib/celluloid/system_events.rb
|
136
|
-
- lib/celluloid/task.rb
|
137
139
|
- lib/celluloid/tasks/task_fiber.rb
|
138
140
|
- lib/celluloid/tasks/task_thread.rb
|
141
|
+
- lib/celluloid/tasks.rb
|
139
142
|
- lib/celluloid/thread_handle.rb
|
140
143
|
- lib/celluloid/uuid.rb
|
141
144
|
- lib/celluloid/version.rb
|
@@ -165,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
165
168
|
version: 1.3.6
|
166
169
|
requirements: []
|
167
170
|
rubyforge_project:
|
168
|
-
rubygems_version: 1.8.
|
171
|
+
rubygems_version: 1.8.23
|
169
172
|
signing_key:
|
170
173
|
specification_version: 3
|
171
174
|
summary: Actor-based concurrent object framework for Ruby
|
@@ -1,45 +0,0 @@
|
|
1
|
-
module Celluloid
|
2
|
-
module StackDumper
|
3
|
-
def self.dump(output = STDERR)
|
4
|
-
actors = {}
|
5
|
-
threads = []
|
6
|
-
|
7
|
-
Thread.list.each do |thread|
|
8
|
-
if actor = thread[:actor]
|
9
|
-
actors[actor.subject.object_id] = actor
|
10
|
-
else
|
11
|
-
threads << thread
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
actors.each do |_, actor|
|
16
|
-
output << "Celluloid::Actor 0x#{actor.subject.object_id.to_s(16)}: #{actor.subject.class}"
|
17
|
-
output << " [#{actor.name}]" if actor.name
|
18
|
-
output << "\n"
|
19
|
-
|
20
|
-
tasks = actor.tasks
|
21
|
-
if tasks.empty?
|
22
|
-
output << "State: Idle (waiting for messages)\n"
|
23
|
-
else
|
24
|
-
output << "State: Running (executing tasks)\n"
|
25
|
-
output << "Tasks:\n"
|
26
|
-
|
27
|
-
tasks.each_with_index do |task, i|
|
28
|
-
output << " #{i+1}) #{task.class}: #{task.status}\n"
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
display_backtrace actor.thread, output
|
33
|
-
end
|
34
|
-
|
35
|
-
threads.each do |thread|
|
36
|
-
output << "Thread 0x#{object_id.to_s(16)}:\n"
|
37
|
-
display_backtrace thread, output
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
def self.display_backtrace(thread, output)
|
42
|
-
output << "\t" << thread.backtrace.join("\n\t") << "\n\n"
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|