Created
April 6, 2025 21:55
-
-
Save AnthonyGiretti/997210ba007f3f8f580b4a7282b1e2b1 to your computer and use it in GitHub Desktop.
Locking before C# 13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private readonly object _lock = new(); | |
void Update() | |
{ | |
lock (_lock) | |
{ | |
// critical section | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment