lib/libuv/loop.rb in libuv-0.12.4 vs lib/libuv/loop.rb in libuv-1.0.0

- old
+ new

@@ -49,17 +49,20 @@ @pointer = pointer @loop = self # Create an async call for scheduling work from other threads @run_queue = Queue.new - @process_queue = Async.new @loop, method(:process_queue_cb) + @process_queue = @loop.async method(:process_queue_cb) + @process_queue.unref # Create a next tick timer @next_tick = @loop.timer method(:next_tick_cb) + @next_tick.unref # Create an async call for ending the loop - @stop_loop = Async.new @loop, method(:stop_cb) + @stop_loop = @loop.async method(:stop_cb) + @stop_loop.unref end protected @@ -71,10 +74,11 @@ ::Libuv::Ext.stop(@pointer) end def next_tick_cb @next_tick_scheduled = false + @next_tick.unref process_queue_cb end def process_queue_cb # ensure we only execute what was required for this tick @@ -378,9 +382,10 @@ if reactor_thread? # Create a next tick timer if not @next_tick_scheduled @next_tick.start(0) @next_tick_scheduled = true + @next_tick.ref end else @process_queue.call end end