Sha256: 0ea579ea76002925f39943b213fd837552c733ef514b2963d29a5b8e52d09f07
Contents?: true
Size: 698 Bytes
Versions: 4
Compression:
Stored size: 698 Bytes
Contents
# frozen_string_literal: true require_relative 'helper' class AsyncTest < MiniTest::Test def test_that_async_watcher_receives_signal_across_threads count = 0 a = Gyro::Async.new spin { a.await count += 1 } snooze Thread.new do orig_sleep 0.001 a.signal! end suspend assert_equal 1, count end def test_that_async_watcher_coalesces_signals count = 0 a = Gyro::Async.new coproc = spin { loop { a.await count += 1 defer { coproc.stop } } } snooze Thread.new do orig_sleep 0.001 3.times { a.signal! } end coproc.await assert_equal 1, count end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
polyphony-0.28 | test/test_async.rb |
polyphony-0.27 | test/test_async.rb |
polyphony-0.26 | test/test_async.rb |
polyphony-0.25 | test/test_async.rb |