class Rufus::Scheduler::EmScheduler
def trigger_job(params, &block)
'next_tick'. Else the block will get called via 'defer' (own thread).
If 'blocking' is set to true, the block will get called at the
def trigger_job(params, &block) # :next_tick monopolizes the EM # :defer executes its block in another thread # (if I read the doc carefully...) if params[:blocking] EM.next_tick { block.call } elsif m = params[:mutex] m = (@mutexes[m.to_s] ||= Mutex.new) unless m.is_a?(Mutex) EM.defer { m.synchronize { block.call } } else EM.defer { block.call } end end