Sha256: cb16709616659720f891e55cfcfad9266c912ebfeb564e4171b05c995b500e4f
Contents?: true
Size: 900 Bytes
Versions: 1
Compression:
Stored size: 900 Bytes
Contents
Feature: wake up another event loop UV::Loop cannot be shared by multiple threads. To wake up a control loop in a different thread, use UV::Loop#async, which is thread safe Scenario: wake up an event loop from a different thread Given a file named "async_example.rb" with: """ require 'uvrb' count = 0 loop = UV::Loop.default timer = loop.timer timer.start(0, 100) do |e| count += 1 sleep(0.2) end callback = loop.async do |e| stopper = loop.timer stopper.start(1000, 0) do |e| timer.close {} callback.close {} stopper.close {} end end Thread.new(callback) do |proc| proc.call end loop.run abort "failure, count is #{count}" if count >= 11 """ When I run `ruby async_example.rb` Then the exit status should be 0
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
uvrb-0.1.0 | features/async.feature |