How to check if a mutex is locked in Go
blog.trailofbits.com | blog | #go | #debugging | #concurrency | #golang | #reflection | #mutex | #sync | #sync-mutex | #assertions
Summary
Go's sync.Mutex can't tell you if it's locked—a deliberate omission due to race conditions. Reflection on the internal state field enables debug-only assertions for mutex preconditions.
- Published
- Collected
Skip to content