Sha256: f2eee45deec987aad6c6c007041ef82767a7db723b44f95c9cf0c9c736632518

Contents?: true

Size: 852 Bytes

Versions: 66

Compression:

Stored size: 852 Bytes

Contents

# $Id$
# Test guts sent in by chetreddy bug #27184
# 
# Note: this test won't always catch a threading problem, as it
# relies on a brute force approach.  NUM_THREADS can be increased
# to stress the system longer and therefore increasing the chance
# of exposing a threading issue, however, it is not a definitive
# test.
#


$: << File.join("..","lib")

require "test/unit"
require 'log4r'
include Log4r

class TestThreads < Test::Unit::TestCase

  NUMTHREADS = 1000

  def test_threads

    assert_nothing_raised do
      (0..NUMTHREADS).map do |i|
        Thread.new do
	  Thread.current[:logger] = Log4r::Logger.new "Hello #{i}"
	  Thread.current[:logger].outputters = [StdoutOutputter.new "log4r#{i}"]
	  Thread.current[:logger].outputters.each { |i| i.flush }
	  Thread.current.exit()
	end
      end.each do |thr| thr.join end
    end
  end
end

Version data entries

66 entries across 36 versions & 4 rubygems

Version Path
depengine-0.0.31 etc/isolate/ruby-1.8/gems/log4r-1.1.8/tests/testthreads.rb
depengine-0.0.31 etc/isolate/jruby-1.8/gems/log4r-1.1.8/tests/testthreads.rb
depengine-0.0.30 etc/isolate/ruby-1.8/gems/log4r-1.1.8/tests/testthreads.rb
depengine-0.0.30 etc/isolate/jruby-1.8/gems/log4r-1.1.8/tests/testthreads.rb
depengine-0.0.29 etc/isolate/ruby-1.8/gems/log4r-1.1.8/tests/testthreads.rb
depengine-0.0.29 etc/isolate/jruby-1.8/gems/log4r-1.1.8/tests/testthreads.rb
depengine-0.0.28 etc/isolate/ruby-1.8/gems/log4r-1.1.8/tests/testthreads.rb
depengine-0.0.28 etc/isolate/jruby-1.8/gems/log4r-1.1.8/tests/testthreads.rb
depengine-0.0.27 etc/isolate/ruby-1.8/gems/log4r-1.1.8/tests/testthreads.rb
depengine-0.0.27 etc/isolate/jruby-1.8/gems/log4r-1.1.8/tests/testthreads.rb
depengine-0.0.26 etc/isolate/jruby-1.8/gems/log4r-1.1.8/tests/testthreads.rb
depengine-0.0.26 etc/isolate/ruby-1.8/gems/log4r-1.1.8/tests/testthreads.rb
depengine-0.0.25 etc/isolate/jruby-1.8/gems/log4r-1.1.8/tests/testthreads.rb
depengine-0.0.25 etc/isolate/ruby-1.8/gems/log4r-1.1.8/tests/testthreads.rb
depengine-0.0.24 etc/isolate/ruby-1.8/gems/log4r-1.1.8/tests/testthreads.rb
depengine-0.0.24 etc/isolate/jruby-1.8/gems/log4r-1.1.8/tests/testthreads.rb
depengine-0.0.23 etc/isolate/jruby-1.8/gems/log4r-1.1.8/tests/testthreads.rb
depengine-0.0.23 etc/isolate/ruby-1.8/gems/log4r-1.1.8/tests/testthreads.rb
depengine-0.0.22 etc/isolate/jruby-1.8/gems/log4r-1.1.8/tests/testthreads.rb
depengine-0.0.22 etc/isolate/ruby-1.8/gems/log4r-1.1.8/tests/testthreads.rb