File tree Expand file tree Collapse file tree 3 files changed +12
-4
lines changed Expand file tree Collapse file tree 3 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ def self.spawn(*args, &block)
70
70
if Actor . current
71
71
Core . new ( spawn_optionify ( *args ) . merge ( parent : Actor . current ) , &block ) . reference
72
72
else
73
- root . ask ( [ :spawn , spawn_optionify ( *args ) , block ] ) . value
73
+ root . ask ( [ :spawn , spawn_optionify ( *args ) , block ] ) . value!
74
74
end
75
75
end
76
76
Original file line number Diff line number Diff line change @@ -46,10 +46,14 @@ def initialize(opts = {}, &block)
46
46
synchronize do
47
47
@mailbox = Array . new
48
48
@serialized_execution = SerializedExecution . new
49
- @executor = Type! opts . fetch ( :executor , Concurrent . configuration . global_task_pool ) , Executor
50
49
@children = Set . new
51
- @context_class = Child! opts . fetch ( :class ) , AbstractContext
50
+
51
+ @context_class = Child! opts . fetch ( :class ) , AbstractContext
52
52
allocate_context
53
+
54
+ @executor = Type! opts . fetch ( :executor , Concurrent . configuration . global_task_pool ) , Executor
55
+ raise ArgumentError , 'ImmediateExecutor is not supported' if @executor . is_a? ImmediateExecutor
56
+
53
57
@reference = ( Child! opts [ :reference_class ] || @context . default_reference_class , Reference ) . new self
54
58
@name = ( Type! opts . fetch ( :name ) , String , Symbol ) . to_s
55
59
@@ -82,7 +86,7 @@ def initialize(opts = {}, &block)
82
86
handle_envelope Envelope . new ( message , nil , parent , reference )
83
87
end
84
88
85
- initialized . set true if initialized
89
+ initialized . set reference if initialized
86
90
rescue => ex
87
91
log ERROR , ex
88
92
@first_behaviour . terminate!
Original file line number Diff line number Diff line change @@ -54,6 +54,10 @@ def on_message(message)
54
54
# set_trace_func nil
55
55
# end
56
56
57
+ it 'forbids Immediate executor' do
58
+ expect { Utils ::AdHoc . spawn name : 'test' , executor : ImmediateExecutor . new } . to raise_error
59
+ end
60
+
57
61
describe 'stress test' do
58
62
1 . times do |i |
59
63
it format ( 'run %3d' , i ) do
You can’t perform that action at this time.
0 commit comments