Skip to content

Instantly share code, notes, and snippets.

@AnthonyGiretti
Created April 6, 2025 21:55
Show Gist options
  • Save AnthonyGiretti/997210ba007f3f8f580b4a7282b1e2b1 to your computer and use it in GitHub Desktop.
Save AnthonyGiretti/997210ba007f3f8f580b4a7282b1e2b1 to your computer and use it in GitHub Desktop.
Locking before C# 13
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