Sha256: 4feeb29eb94fa7e41e7e7957dc30b48bb50eb737dad6a9d18f448e4e690b4ff3

Contents?: true

Size: 1.06 KB

Versions: 47

Compression:

Stored size: 1.06 KB

Contents

module Dynflow
  module Semaphores
    class Abstract

      # Tries to get ticket from the semaphore
      # Returns true if thing got a ticket
      # Rturns false otherwise and puts the thing into the semaphore's queue
      def wait(thing)
        raise NotImplementedError
      end

      # Gets first object from the queue
      def get_waiting
        raise NotImplementedError
      end

      # Checks if there are objects in the queue
      def has_waiting?
        raise NotImpelementedError
      end

      # Returns n tickets to the semaphore
      def release(n = 1)
        raise NotImplementedError
      end

      # Saves the semaphore's state to some persistent storage
      def save
        raise NotImplementedError
      end

      # Tries to get n tickets
      # Returns n if the semaphore has free >= n
      # Returns free if n > free
      def get(n = 1)
        raise NotImplementedErrorn
      end

      # Requests all tickets
      # Returns all free tickets from the semaphore
      def drain
        raise NotImplementedError
      end
    end
  end
end

Version data entries

47 entries across 47 versions & 1 rubygems

Version Path
dynflow-1.3.0 lib/dynflow/semaphores/abstract.rb
dynflow-1.2.3 lib/dynflow/semaphores/abstract.rb
dynflow-1.2.2 lib/dynflow/semaphores/abstract.rb
dynflow-1.2.1 lib/dynflow/semaphores/abstract.rb
dynflow-1.2.0 lib/dynflow/semaphores/abstract.rb
dynflow-1.2.0.pre1 lib/dynflow/semaphores/abstract.rb
dynflow-1.1.6 lib/dynflow/semaphores/abstract.rb
dynflow-1.1.5 lib/dynflow/semaphores/abstract.rb
dynflow-1.1.4 lib/dynflow/semaphores/abstract.rb
dynflow-1.1.3 lib/dynflow/semaphores/abstract.rb
dynflow-1.1.2 lib/dynflow/semaphores/abstract.rb
dynflow-1.1.1 lib/dynflow/semaphores/abstract.rb
dynflow-1.1.0 lib/dynflow/semaphores/abstract.rb
dynflow-1.0.5 lib/dynflow/semaphores/abstract.rb
dynflow-1.0.4 lib/dynflow/semaphores/abstract.rb
dynflow-1.0.3 lib/dynflow/semaphores/abstract.rb
dynflow-1.0.2 lib/dynflow/semaphores/abstract.rb
dynflow-1.0.1 lib/dynflow/semaphores/abstract.rb
dynflow-1.0.0 lib/dynflow/semaphores/abstract.rb
dynflow-0.8.37 lib/dynflow/semaphores/abstract.rb