…how to lock a piece of code so that it's guaranteed to only run once at a time. If it's running and another thread (or Goroutine in my case) reaches the same piece of code, it will wait for the first process to finish before continuing its execution.

I'm using it to lock an entire function, but apparently it works for any section of code.

Read more
Subscribe to concurrency
Mastodon Mastodon