package mutex
import "github.com/amonks/run/internal/mutex"
Index
Types
type Mutex
type Mutex struct { // contains filtered or unexported fields }
Mutex wraps sync.Mutex, providing these additional features:
- You can `defer Lock(...).Unlock()` in a single line
- If `debug` is true, Mutex lock/unlock info will be logged to Mutex.log.
- You can log additional info to Mutex.log with [Mutex.printf].
func New
func New(name string) *Mutex
func (*Mutex) Lock
func (mu *Mutex) Lock(name string) *Mutex
func (*Mutex) Unlock
func (mu *Mutex) Unlock()