Class: Dramatis::Runtime::Task
- Inherits:
-
Object
- Object
- Dramatis::Runtime::Task
- Defined in:
- lib/dramatis/runtime/task.rb
Overview
:nodoc: all
Defined Under Namespace
Modules: Continuation
Instance Attribute Summary collapse
-
#actor ⇒ Object
readonly
Returns the value of attribute actor.
-
#call_thread ⇒ Object
readonly
Returns the value of attribute call_thread.
Instance Method Summary collapse
- #arguments ⇒ Object
- #deliver ⇒ Object
- #exception(e) ⇒ Object
-
#initialize(actor, dest, args, options) ⇒ Task
constructor
A new instance of Task.
- #method ⇒ Object
- #queued ⇒ Object
- #type ⇒ Object
Constructor Details
#initialize(actor, dest, args, options) ⇒ Task
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/dramatis/runtime/task.rb', line 26 def initialize actor, dest, args, @actor = actor @dest = dest @args = args.dup @call_thread = nil name = Dramatis::Runtime::Scheduler.actor actor = name.instance_eval { @actor } object_id = actor.object.object_id @args.each_with_index do |arg,i| if arg.object_id == object_id @args[i] = name end end if actor.call_threading? # warn "oct #{options[:call_thread]} act #{actor.call_thread}" raise "hell" if [:call_thread] and actor.call_thread and [:call_thread] != actor.call_thread @call_thread = actor.call_thread if @call_thread == nil @call_thread = self.to_s end end # warn "task #{self} #{args[0]} call thread [ #{@call_thread} ] #{options.to_a.join(' ')}" case [:continuation] when :none @continuation = Continuation::None.new name, @call_thread when :rpc @continuation = Continuation::RPC.new name, @call_thread, [:nonblocking] when :future @continuation = Continuation::Future.new name, @call_thread when Proc @continuation = Continuation::Proc.new name, @call_thread, [:continuation], [:exception] else raise Dramatis::Internal.new( "invalid contiunation type" ) end end |
Instance Attribute Details
#actor ⇒ Object (readonly)
Returns the value of attribute actor.
10 11 12 |
# File 'lib/dramatis/runtime/task.rb', line 10 def actor @actor end |
#call_thread ⇒ Object (readonly)
Returns the value of attribute call_thread.
24 25 26 |
# File 'lib/dramatis/runtime/task.rb', line 24 def call_thread @call_thread end |
Instance Method Details
#arguments ⇒ Object
20 21 22 |
# File 'lib/dramatis/runtime/task.rb', line 20 def arguments @args[1,@args.length] end |
#deliver ⇒ Object
82 83 84 |
# File 'lib/dramatis/runtime/task.rb', line 82 def deliver @actor.deliver @dest, @args, @continuation, @call_thread end |
#exception(e) ⇒ Object
74 75 76 |
# File 'lib/dramatis/runtime/task.rb', line 74 def exception e @continuation.exception e end |
#method ⇒ Object
16 17 18 |
# File 'lib/dramatis/runtime/task.rb', line 16 def method @args[0] end |
#queued ⇒ Object
78 79 80 |
# File 'lib/dramatis/runtime/task.rb', line 78 def queued @continuation.queued end |
#type ⇒ Object
12 13 14 |
# File 'lib/dramatis/runtime/task.rb', line 12 def type @dest end |