Class: At_email::Tasks::TaskThread
- Inherits:
-
Core::Default
- Object
- Core::Default
- At_email::Tasks::TaskThread
- Defined in:
- lib/at_email/threads/thread_queue.rb
Constant Summary collapse
- CLASS_DISPLAY_NAME =
'Thread'
Instance Attribute Summary collapse
-
#thread_ref ⇒ Object
Returns the value of attribute thread_ref.
Attributes inherited from Core::Default
Instance Method Summary collapse
-
#initialize ⇒ TaskThread
constructor
A new instance of TaskThread.
- #queue(code) ⇒ Object
- #start ⇒ Object
- #stop ⇒ Object
Methods inherited from Core::Default
#get, #get_formatted, #get_state, #set_state
Constructor Details
#initialize ⇒ TaskThread
Returns a new instance of TaskThread.
55 56 57 58 59 60 61 |
# File 'lib/at_email/threads/thread_queue.rb', line 55 def initialize super if !@properties return false end @properties['Display Name'] = CLASS_DISPLAY_NAME end |
Instance Attribute Details
#thread_ref ⇒ Object
Returns the value of attribute thread_ref.
53 54 55 |
# File 'lib/at_email/threads/thread_queue.rb', line 53 def thread_ref @thread_ref end |
Instance Method Details
#queue(code) ⇒ Object
63 64 65 66 67 68 69 70 71 72 |
# File 'lib/at_email/threads/thread_queue.rb', line 63 def queue(code) log_string = 'Queueing' log_event('D', event_data) set('Queue Time', Time.now) Thread.abort_on_exception = true @thread_ref = Thread.new do sleep 0.1 code end end |
#start ⇒ Object
74 75 76 |
# File 'lib/at_email/threads/thread_queue.rb', line 74 def start @properties['Start Time'] = Time.now end |
#stop ⇒ Object
78 79 80 81 |
# File 'lib/at_email/threads/thread_queue.rb', line 78 def stop @properties['Stop Time'] = Time.now Thread.kill(@thread_ref) end |