Sha256: 0df9c110be4bf5edb9cd81ed071e599895427880b00912f0ec64f719140d934a
Contents?: true
Size: 903 Bytes
Versions: 2
Compression:
Stored size: 903 Bytes
Contents
module DeepTest class SimpleTestBlackboard attr_accessor :debug def initialize @work_units = [] @test_results = [] @semaphore = Mutex.new end def take_result @semaphore.synchronize do log_and_return "take_result", @test_results.shift end end def take_work @semaphore.synchronize do log_and_return "take_work", @work_units.shift end end def write_result(result) @semaphore.synchronize do log_and_return "write_result", result @test_results.push result end end def write_work(work_unit) @semaphore.synchronize do log_and_return "write_work", work_unit @work_units.push work_unit end end def log_and_return(message, object) if debug && object puts "* #{message} #{object.inspect}" end object end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
deep_test-1.1.3 | test/simple_test_blackboard.rb |
deep_test-1.1.4 | test/simple_test_blackboard.rb |