celluloid 0.15.0 → 0.15.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/celluloid.rb +1 -1
- data/lib/celluloid/pool_manager.rb +1 -0
- data/lib/celluloid/tasks.rb +12 -3
- data/spec/celluloid/pool_spec.rb +7 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d074071245d3218d8e119b0bf9f12f05aab6c8f
|
4
|
+
data.tar.gz: 5b7fb44228ae18ed9d1d64f9a26ae82bc61acf6f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a006db60f84694c38e5ff90585c5890b1eed7b5b517f302d3d6e9a50552e6c5c44df07d50dce9bc6a2d87d7f91470c7d9a617d427e3f4e28426ecbb4affe3c6
|
7
|
+
data.tar.gz: 1969c4c6ba4fc4bdedc606b5009d5ab0aacf73d76a48c905a523f2774ca75696eb5e81b338702f07aa8da7c16bff6e5d6f1cb72ce77957258411d4cf0c94c3af
|
data/lib/celluloid.rb
CHANGED
data/lib/celluloid/tasks.rb
CHANGED
@@ -25,7 +25,7 @@ module Celluloid
|
|
25
25
|
end
|
26
26
|
|
27
27
|
attr_reader :type, :meta, :status
|
28
|
-
attr_accessor :chain_id
|
28
|
+
attr_accessor :chain_id, :guard_warnings
|
29
29
|
|
30
30
|
# Create a new task
|
31
31
|
def initialize(type, meta)
|
@@ -35,12 +35,13 @@ module Celluloid
|
|
35
35
|
|
36
36
|
@exclusive = false
|
37
37
|
@dangerous_suspend = @meta ? @meta.delete(:dangerous_suspend) : false
|
38
|
+
@guard_warnings = false
|
38
39
|
|
39
40
|
actor = Thread.current[:celluloid_actor]
|
40
41
|
@chain_id = CallChain.current_id
|
41
42
|
|
42
43
|
raise NotActorError, "can't create tasks outside of actors" unless actor
|
43
|
-
|
44
|
+
guard "can't create tasks inside of tasks" if Thread.current[:celluloid_task]
|
44
45
|
|
45
46
|
create do
|
46
47
|
begin
|
@@ -93,7 +94,7 @@ module Celluloid
|
|
93
94
|
|
94
95
|
# Resume a suspended task, giving it a value to return if needed
|
95
96
|
def resume(value = nil)
|
96
|
-
|
97
|
+
guard "Cannot resume a task from inside of a task" if Thread.current[:celluloid_task]
|
97
98
|
deliver(value)
|
98
99
|
nil
|
99
100
|
end
|
@@ -141,6 +142,14 @@ module Celluloid
|
|
141
142
|
def inspect
|
142
143
|
"#<#{self.class}:0x#{object_id.to_s(16)} @type=#{@type.inspect}, @meta=#{@meta.inspect}, @status=#{@status.inspect}>"
|
143
144
|
end
|
145
|
+
|
146
|
+
def guard(message)
|
147
|
+
if @guard_warnings
|
148
|
+
Logger.warn message if $CELLULOID_DEBUG
|
149
|
+
else
|
150
|
+
raise message if $CELLULOID_DEBUG
|
151
|
+
end
|
152
|
+
end
|
144
153
|
end
|
145
154
|
end
|
146
155
|
|
data/spec/celluloid/pool_spec.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: celluloid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.15.
|
4
|
+
version: 0.15.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tony Arcieri
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-09-
|
11
|
+
date: 2013-09-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: timers
|