File: array_spec.rb

package info (click to toggle)
ruby-thread-safe 0.3.6-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, forky, sid, trixie
  • size: 712 kB
  • sloc: java: 5,458; ruby: 2,917; makefile: 6
file content (18 lines) | stat: -rw-r--r-- 342 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
module ThreadSafe
  describe Array do
    let!(:ary) { described_class.new }

    it 'concurrency' do
      (1..THREADS).map do |i|
        Thread.new do
          1000.times do
            ary << i
            ary.each { |x| x * 2 }
            ary.shift
            ary.last
          end
        end
      end.map(&:join)
    end
  end
end