Sha256: 2df9328c9abf227e1061d6fafbd2d7ad0d3e552877e1ab5aa8afdef861cd8a36

Contents?: true

Size: 801 Bytes

Versions: 2

Compression:

Stored size: 801 Bytes

Contents

module RMXFirebase

  QUEUE = Dispatch::Queue.new("RMXFirebase")
  INTERNAL_QUEUE = Dispatch::Queue.new("RMXFirebase.internal")

  DEBUG_IDENTITY_MAP = RMX::Env['rmx_firebase_debug_identity_map'] == '1'
  DEBUG_MODEL_DEALLOC = RMX::Env['rmx_firebase_debug_model_dealloc'] == '1'

  def self.queue_for(queueish)
    if queueish == :main || queueish.nil?
      Dispatch::Queue.main
    elsif queueish == :async
      QUEUE
    else
      queueish
    end
  end

  def self.block_on_queue(queue, *args, &block)
    queue = queue_for(queue)
    if queue == Dispatch::Queue.main && NSThread.currentThread.isMainThread
      block.call(*args)
    else
      queue.barrier_async do
        block.call(*args)
      end
    end
  end

end
Firebase.setDispatchQueue(RMXFirebase::INTERNAL_QUEUE.dispatch_object)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rmx-firebase-0.0.3 lib/motion/RMXFirebase.rb
rmx-firebase-0.0.2 lib/motion/RMXFirebase.rb