fix updating
This commit is contained in:
@@ -3,10 +3,32 @@ package mutex
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"sync"
|
||||
)
|
||||
|
||||
const maxMutexLength = 64
|
||||
|
||||
var (
|
||||
globalRelease func()
|
||||
globalMu sync.Mutex
|
||||
)
|
||||
|
||||
func SetGlobalRelease(fn func()) {
|
||||
globalMu.Lock()
|
||||
globalRelease = fn
|
||||
globalMu.Unlock()
|
||||
}
|
||||
|
||||
func ReleaseGlobal() {
|
||||
globalMu.Lock()
|
||||
fn := globalRelease
|
||||
globalRelease = nil
|
||||
globalMu.Unlock()
|
||||
if fn != nil {
|
||||
fn()
|
||||
}
|
||||
}
|
||||
|
||||
func sanitizeName(name string) (string, error) {
|
||||
trimmed := strings.TrimSpace(name)
|
||||
if trimmed == "" {
|
||||
|
||||
Reference in New Issue
Block a user