From ddda90d29c4fbe11049d5904ef065f3e886f5068 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Mon, 2 Aug 2021 20:47:36 -0700 Subject: [PATCH] Revert "Make the Ruby DSL use a unique filename for each implicit file." This reverts commit db12f11466f20e405687c1b3e45cad4052702d8b. --- ruby/lib/google/protobuf/descriptor_dsl.rb | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/ruby/lib/google/protobuf/descriptor_dsl.rb b/ruby/lib/google/protobuf/descriptor_dsl.rb index ba1a255f04..3c1b8e41d0 100644 --- a/ruby/lib/google/protobuf/descriptor_dsl.rb +++ b/ruby/lib/google/protobuf/descriptor_dsl.rb @@ -7,24 +7,7 @@ require 'google/protobuf/descriptor_pb' module Google module Protobuf module Internal - class AtomicCounter - def initialize - @n = 0 - @mu = Mutex.new - end - - def get_and_increment - n = @n - @mu.synchronize { - @n += 1 - } - return n - end - end - class Builder - @@file_number = AtomicCounter.new - def initialize(pool) @pool = pool @default_file = nil # Constructed lazily @@ -59,9 +42,7 @@ module Google end private def internal_default_file - number = @@file_number.get_and_increment - filename = "ruby_default_file#{number}.proto" - @default_file ||= FileBuilder.new(@pool, filename) + @default_file ||= FileBuilder.new(@pool, "ruby_default_file.proto") end end