Skip to content

Commit

Permalink
Revert "Make the Ruby DSL use a unique filename for each implicit file."
Browse files Browse the repository at this point in the history
This reverts commit db12f11.
  • Loading branch information
haberman committed Aug 3, 2021
1 parent e9b3686 commit ddda90d
Showing 1 changed file with 1 addition and 20 deletions.
21 changes: 1 addition & 20 deletions ruby/lib/google/protobuf/descriptor_dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,7 @@
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
Expand Down Expand Up @@ -59,9 +42,7 @@ def build
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

Expand Down

0 comments on commit ddda90d

Please sign in to comment.