Class: Task
Defined Under Namespace
Class Method Summary (collapse)
-
+ (Object) after(delay, &block)
Schedule a block after a given interval (in seconds).
-
+ (Object) background(&block)
Run a block concurrently in the background Blocks will be distributed among a pool of threads and may be executed in parallel.
-
+ (Timer) every(interval, &block)
Schedule a block at every given interval (in seconds).
-
+ (Object) main(&block)
Run a block on the main thread.
-
+ (Object) main?
Check is the method has been called from the main thread.
-
+ (Queue) queue
Create a serial queue A Task::Queue object keeps a reference to a single thread.
Class Method Details
+ (Object) after(delay, &block)
Schedule a block after a given interval (in seconds)
37 38 39 |
# File 'flow/task/task.rb', line 37 def self.after(delay, &block) Task::Timer.new(delay, false, block) end |
+ (Object) background(&block)
Run a block concurrently in the background Blocks will be distributed among a pool of threads and may be executed in parallel.
56 57 58 |
# File 'flow/task/task.rb', line 56 def self.background(&block) Task::Queue.schedule_on_background(block) end |
+ (Timer) every(interval, &block)
Schedule a block at every given interval (in seconds)
28 29 30 |
# File 'flow/task/task.rb', line 28 def self.every(interval, &block) Task::Timer.new(interval, true, block) end |
+ (Object) main(&block)
Run a block on the main thread
46 47 48 |
# File 'flow/task/task.rb', line 46 def self.main(&block) Task::Queue.schedule_on_main(block) end |
+ (Object) main?
Check is the method has been called from the main thread
|
# File 'flow/task/task.rb', line 69
|
+ (Queue) queue
Create a serial queue A Task::Queue
object keeps a reference
to a single thread.
65 66 67 |
# File 'flow/task/task.rb', line 65 def self.queue Task::Queue.new end |