Skip to content

Commit

Permalink
fix locking post cherry-picks
Browse files Browse the repository at this point in the history
  • Loading branch information
p committed Feb 16, 2024
1 parent 3e91f3b commit 0f2fb9e
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions lib/datadog/core/remote/component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,7 @@ def wait_once(timeout = nil)
# Since @once only ever goes from false to true, this is semantically valid
return :pass if @once

begin
@mutex.lock

@mutex.synchronize do
return :pass if @once

now = Core::Utils::Time.get_time
Expand Down Expand Up @@ -184,13 +182,11 @@ def wait_once(timeout = nil)
# technically permitted; second and subsequent calls have no
# effect.
def lift
@mutex.lock
@mutex.synchronize do
@once ||= true

@once ||= true

@condition.broadcast
ensure
@mutex.unlock
@condition.broadcast
end
end
end

Expand Down

0 comments on commit 0f2fb9e

Please sign in to comment.