Documentation ¶
Index ¶
Constants ¶
View Source
const (
LockCount = 256
)
Variables ¶
This section is empty.
Functions ¶
func LockIndexForKey ¶ added in v0.7.0
Types ¶
type LockEntry ¶ added in v0.7.0
func CreateLocks ¶
func CreateLocks() []*LockEntry
CreateLocks returns an array so that the locks can be iterated over in order.
This is only threadsafe if a process is using a single lock, or iterating over the entire lock slice in order. Using a consistent order avoids deadlocks because you can never have the following:
Lock A, Lock B Lock B, Lock A
Where process 1 is now deadlocked trying to lock B, and process 2 deadlocked trying to lock A
func LockForKey ¶ added in v0.7.0
func LocksForKeys ¶ added in v0.9.1
Click to show internal directories.
Click to hide internal directories.