Sha256: 1b30208c594e79420482d2de1504a57b7d7c7bbfde7bfab194cf1999c70eb4c5

Contents?: true

Size: 876 Bytes

Versions: 5

Compression:

Stored size: 876 Bytes

Contents

# Author::    Nicolas Despres  <nicolas.despres@gmail.com>.
# Copyright:: Copyright (c) 2004, 2005 TTK team. All rights reserved.
# License::   LGPL
# $Id: running_task.rb 567 2005-04-13 08:00:06Z polrop $


module TTK

  module Testers

    class Tester

      class RunningTask

        def initialize
          @mutex = Mutex.new
          @hash = {}
        end

        def []=(key, val)
          @mutex.synchronize { @hash[key] = val }
        end

        def delete(key)
          @mutex.synchronize { @hash.delete(key) }
        end

        def size
          @mutex.synchronize { @hash.size }
        end

        alias length size

        def abort(key)
          @mutex.synchronize do
            @hash[key].abort if @hash.has_key?(key)
          end
        end

      end # class RunningTask

    end # class Tester

  end # module Testers

end # module TTK

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ttk-0.1.576 lib/ttk/testers/tester/running_task.rb
ttk-0.1.580 lib/ttk/testers/tester/running_task.rb
ttk-0.2.1 lib/ttk/testers/tester/running_task.rb
ttk-0.2.0 lib/ttk/testers/tester/running_task.rb
ttk-0.1.579 lib/ttk/testers/tester/running_task.rb