MCPcopy
hub / github.com/gogf/gf / Lock

Method Lock

os/gmlock/gmlock_locker.go:35–37  ·  view source on GitHub ↗

Lock locks the `key` with writing lock. If there's a write/reading lock the `key`, it will block until the lock is released.

(key string)

Source from the content-addressed store, hash-verified

33// If there's a write/reading lock the `key`,
34// it will block until the lock is released.
35func (l *Locker) Lock(key string) {
36 l.getOrNewMutex(key).Lock()
37}
38
39// TryLock tries locking the `key` with writing lock,
40// it returns true if success, or it returns false if there's a writing/reading lock the `key`.

Callers 15

LockFuncMethod · 0.95
OnChangeMethod · 0.45
LoadMethod · 0.45
SetConverterMethod · 0.45
SetWatchErrorHandlerMethod · 0.45
SetReuseTargetStructMethod · 0.45
StopWatchMethod · 0.45
SetLoggerMethod · 0.45
StartMethod · 0.45
StopMethod · 0.45
CloseMethod · 0.45

Calls 1

getOrNewMutexMethod · 0.95

Tested by 5

truncateGlobalAttributesFunction · 0.36
Test_Locker_LockFunction · 0.36