diff options
-rw-r--r-- | spec/ffi/function_spec.rb | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/spec/ffi/function_spec.rb b/spec/ffi/function_spec.rb index 14fe31c..a17cbbe 100644 --- a/spec/ffi/function_spec.rb +++ b/spec/ffi/function_spec.rb @@ -64,10 +64,13 @@ describe FFI::Function do it 'can wrap a blocking function' do fp = FFI::Function.new(:void, [ :int ], @libtest.find_function('testBlocking'), :blocking => true) - time = Time.now - threads = [] - threads << Thread.new { fp.call(2) } - threads << Thread.new(time) { expect(Time.now - time).to be < 1 } + threads = 10.times.map do |x| + Thread.new do + time = Time.now + fp.call(2) + expect(Time.now - time).to be > 2 + end + end threads.each { |t| t.join } end |