trylock uses unsafe, which is sorta "unsafe", but should work until sync.Mutex
will change its layout (I hope it never will).
Usage
type LockedStruct struct {
mu trylock.Mutex
}
storage := &LockedStruct{}
if storage.mu.TryLock() {
// do something with storage
} else {
// return busy or use some logic for unavailable storage
}
Unlock unlocks m.
It is a run-time error if m is not locked on entry to Unlock.
A locked Mutex is not associated with a particular goroutine.
It is allowed for one goroutine to lock a Mutex and then
arrange for another goroutine to unlock it.