Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixed to interlock pattern
  • Loading branch information
NaluTripician committed Dec 28, 2023
commit 37905c8d83d29b49a99e4d54aa67d3386c74c147
10 changes: 3 additions & 7 deletions Microsoft.Azure.Cosmos/src/Routing/GlobalEndpointManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -351,14 +351,10 @@ private static bool IsNonRetriableException(Exception exception)

public void Dispose()
{
lock (this)
if (Interlocked.Increment(ref this.disposeCounter) == 1)
{
if (this.disposeCounter == 0)
{
Interlocked.Increment(ref this.disposeCounter);
this.CancellationTokenSource?.Cancel();
this.CancellationTokenSource?.Dispose();
}
this.CancellationTokenSource?.Cancel();
this.CancellationTokenSource?.Dispose();
}
}
}
Expand Down