Sha256: 7f3d6db655ad4396a083d0699fadafc01000003643beb152428908fd00fe0973
Contents?: true
Size: 1.1 KB
Versions: 22
Compression:
Stored size: 1.1 KB
Contents
require 'libuv' describe Libuv::Accessors do describe 'basic usage' do it 'should work seamlessly with the default thread' do count = 0 reactor do |reactor| reactor.timer { count += 1 reactor.stop if count == 3 }.start(50, 10) end expect(count).to eq(3) end it 'work simply with new threads' do count = 0 sig = ConditionVariable.new mutex = Mutex.new mutex.synchronize { # This will run on a new thread Libuv::Reactor.new do |reactor| reactor.timer { count += 1 if count == 3 reactor.stop mutex.synchronize { sig.signal } end }.start(50, 10) end sig.wait(mutex) } expect(count).to eq(3) end end end
Version data entries
22 entries across 22 versions & 1 rubygems