Sha256: a9d571b4c0343bfbe54bbdd458a0dd1eed90e0daff07898463311537aec9e7c9

Contents?: true

Size: 429 Bytes

Versions: 13

Compression:

Stored size: 429 Bytes

Contents

require 'test/unit'
require 'thread_safe'

class TestHash < Test::Unit::TestCase
  def test_concurrency
    hsh = ThreadSafe::Hash.new
    assert_nothing_raised do
      (1..100).map do |i|
        Thread.new do
          1000.times do |j|
            hsh[i*1000+j] = i
            hsh.each {|k,v| k + v}
            hsh[i*1000+j]
            hsh.delete(i*1000+j)
          end
        end
      end.map(&:join)
    end
  end
end

Version data entries

13 entries across 13 versions & 3 rubygems

Version Path
thread_safe-0.1.3 test/test_hash.rb
thread_safe-0.1.3-java test/test_hash.rb
thread_safe-ianunruh-0.1.1 test/test_hash.rb
thread_safe-ianunruh-0.1.1-java test/test_hash.rb
thread_safe-0.1.2 test/test_hash.rb
thread_safe-0.1.2-java test/test_hash.rb
thread_safe-0.1.1 test/test_hash.rb
thread_safe-0.1.1-java test/test_hash.rb
challah-1.0.0 vendor/bundle/gems/thread_safe-0.1.0/test/test_hash.rb
thread_safe-0.1.0 test/test_hash.rb
thread_safe-0.0.3 test/test_hash.rb
thread_safe-0.0.2 test/test_hash.rb
thread_safe-0.0.1 test/test_hash.rb