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{}))
| 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. |
| 264 | func (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. |