diff options
author | tduehr <td@matasano.com> | 2014-12-11 10:05:44 -0600 |
---|---|---|
committer | tduehr <td@matasano.com> | 2014-12-11 10:05:44 -0600 |
commit | ca050208d81e5a1b775215582eade11832005793 (patch) | |
tree | cc733334679950fd504d133e08a4634cce54d2ce | |
parent | 2684dd8615ab1665b2276a7a7eff4315c7677b78 (diff) | |
parent | c66961af7fcc44121a7d060734d300afd3120419 (diff) | |
download | ffi-ca050208d81e5a1b775215582eade11832005793.tar.gz |
Merge pull request #397 from tduehr/fix_test
fix blocking function spec
-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 |