class Google::Protobuf::Internal::AtomicCounter

Public Class Methods

new() click to toggle source
# File lib/google/protobuf/descriptor_dsl.rb, line 18
def initialize
  @n = 0
  @mu = Mutex.new
end

Public Instance Methods

get_and_increment() click to toggle source
# File lib/google/protobuf/descriptor_dsl.rb, line 23
def get_and_increment
  n = @n
  @mu.synchronize {
    @n += 1
  }
  return n
end