Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Short circuit repetitive BuildManager.Dispose calls #10690

Merged
merged 1 commit into from
Oct 7, 2024

Conversation

JanKrivanek
Copy link
Member

Fixes #10260

Context

The BuildManager.Dispose was idempotent, but it wasn't very clear - needed code archeology, plus was easy to break.
Let's make it more clear.

Changes Made

Changed just 2 lines:

  • Consolidated disposing and _disposed check before lock (performing first the cheaper one on local parameter)
  • Added explicit short circuit check of _disposed after entering the lock

Rest of the displayed diff is caused by changed indention due to consolidating the 2 checks before locking.

@JanKrivanek JanKrivanek changed the title Short circuit double dispose Short circuit repetitive BuildManager.Dispose calls Sep 23, 2024
@JanKrivanek JanKrivanek enabled auto-merge (squash) September 26, 2024 11:13
@JanKrivanek JanKrivanek merged commit 2e87605 into main Oct 7, 2024
10 checks passed
@JanKrivanek JanKrivanek deleted the proto/buildmgr-dispose branch October 7, 2024 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Is the double-checked locking pattern in BuildManager correct?
3 participants