MCPcopy Create free account
hub / github.com/aceld/zinx / LockFunc

Method LockFunc

zutils/shard_lock_map.go:264–270  ·  view source on GitHub ↗

LockFunc executes a function with write lock on all shards. WARNING: Do not perform operations on the container within f to avoid deadlocks.

(f func(shardData map[string]interface{}))

Source from the content-addressed store, hash-verified

262// LockFunc executes a function with write lock on all shards.
263// WARNING: Do not perform operations on the container within f to avoid deadlocks.
264func (slm ShardLockMaps) LockFunc(f func(shardData map[string]interface{})) {
265 for _, shard := range slm.shards {
266 shard.Lock()
267 f(shard.items)
268 shard.Unlock()
269 }
270}
271
272// RLockFunc executes a function with read lock on all shards.
273// WARNING: Do not perform write operations on the container within f to avoid deadlocks.

Callers 1

TestLockFuncFunction · 0.95

Calls

no outgoing calls

Tested by 1

TestLockFuncFunction · 0.76