FYI mutexkv
is gone from recent versions of the v2 SDK, so the way to do it is:
import (
"sync"
)
var myMutex sync.Mutex
func foobar() {
myMutex.Lock()
// ...
myMutex.Unlock()
}
Actually, all mutexkv
was was a handy wapper around that to provide a map of multiple sync.Mutex
s behind a string
key. So, useful maybe, but not necessary and easily replicable. (Presumably that’s why it was removed!)
Unfortunately it was only after I’d worked this out that I discovered the third-party API I was using had changed, and I no longer need it, but maybe it’ll help someone else, or future me!