Skip to content

empty-critical-section

Default severity: warning

A lock immediately followed by its matching unlock protects no work and is commonly a missing defer. Intentional empty critical sections used for synchronization should be documented and suppressed explicitly.

mutex.Lock()
mutex.Unlock()
mutex.Lock()
defer mutex.Unlock()