1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
module Celluloid
class Thread < ::Thread
def celluloid?
true
end
attr_accessor :busy
# Obtain the role of this thread
def role
self[:celluloid_role]
end
def role=(role)
self[:celluloid_role] = role
end
# Obtain the Celluloid::Actor object for this thread
def actor
self[:celluloid_actor]
end
# Obtain the Celluloid task object for this thread
def task
self[:celluloid_task]
end
# Obtain the Celluloid mailbox for this thread
def mailbox
self[:celluloid_mailbox]
end
# Obtain the call chain ID for this thread
def call_chain_id
self[:celluloid_chain_id]
end
def <<(proc)
self[:celluloid_queue] << proc
self
end
end
end
|