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)
7070 if Actor . current
7171 Core . new ( spawn_optionify ( *args ) . merge ( parent : Actor . current ) , &block ) . reference
7272 else
73- root . ask ( [ :spawn , spawn_optionify ( *args ) , block ] ) . value
73+ root . ask ( [ :spawn , spawn_optionify ( *args ) , block ] ) . value!
7474 end
7575 end
7676
Original file line number Diff line number Diff line change @@ -46,10 +46,14 @@ def initialize(opts = {}, &block)
4646 synchronize do
4747 @mailbox = Array . new
4848 @serialized_execution = SerializedExecution . new
49- @executor = Type! opts . fetch ( :executor , Concurrent . configuration . global_task_pool ) , Executor
5049 @children = Set . new
51- @context_class = Child! opts . fetch ( :class ) , AbstractContext
50+
51+ @context_class = Child! opts . fetch ( :class ) , AbstractContext
5252 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+
5357 @reference = ( Child! opts [ :reference_class ] || @context . default_reference_class , Reference ) . new self
5458 @name = ( Type! opts . fetch ( :name ) , String , Symbol ) . to_s
5559
@@ -82,7 +86,7 @@ def initialize(opts = {}, &block)
8286 handle_envelope Envelope . new ( message , nil , parent , reference )
8387 end
8488
85- initialized . set true if initialized
89+ initialized . set reference if initialized
8690 rescue => ex
8791 log ERROR , ex
8892 @first_behaviour . terminate!
Original file line number Diff line number Diff line change @@ -54,6 +54,10 @@ def on_message(message)
5454 # set_trace_func nil
5555 # end
5656
57+ it 'forbids Immediate executor' do
58+ expect { Utils ::AdHoc . spawn name : 'test' , executor : ImmediateExecutor . new } . to raise_error
59+ end
60+
5761 describe 'stress test' do
5862 1 . times do |i |
5963 it format ( 'run %3d' , i ) do
You can’t perform that action at this time.
0 commit comments