Module: RMExtensions::ObjectExtensions::Queues
- Defined in:
- lib/motion/queues.rb
Overview
These helper methods are all for async mode.
Instance Method Summary collapse
-
#rmext_on_concurrent_q(q, &block) ⇒ Object
execute a block on a concurrent queue, asynchronously.
-
#rmext_on_main_q(&block) ⇒ Object
execute a block on the main queue, asynchronously.
-
#rmext_on_serial_q(q, &block) ⇒ Object
execute a block on a serial queue, asynchronously.
Instance Method Details
#rmext_on_concurrent_q(q, &block) ⇒ Object
execute a block on a concurrent queue, asynchronously.
28 29 30 31 |
# File 'lib/motion/queues.rb', line 28 def rmext_on_concurrent_q(q, &block) key = "#{NSBundle.mainBundle.bundleIdentifier}.concurrent.#{q}" Dispatch::Queue.concurrent(key).async(&block) end |
#rmext_on_main_q(&block) ⇒ Object
execute a block on the main queue, asynchronously.
16 17 18 |
# File 'lib/motion/queues.rb', line 16 def rmext_on_main_q(&block) Dispatch::Queue.main.async(&block) end |
#rmext_on_serial_q(q, &block) ⇒ Object
execute a block on a serial queue, asynchronously.
21 22 23 24 25 |
# File 'lib/motion/queues.rb', line 21 def rmext_on_serial_q(q, &block) key = "#{NSBundle.mainBundle.bundleIdentifier}.serial.#{q}" ::RMExtensions.serial_qs[key] ||= Dispatch::Queue.new(key) ::RMExtensions.serial_qs[key].async(&block) end |