bundler/bundler-api

View on GitHub
lib/bundler_api/update/atomic_counter.rb

Summary

Maintainability
A
0 mins
Test Coverage
module BundlerApi
  class AtomicCounter

    def initialize
      @count = 0
      @mutex = Mutex.new
    end

    def count
      @mutex.synchronize do
        @count
      end
    end

    def increment
      @mutex.synchronize do
        @count += 1
      end
    end
  end
end