Documentation ¶
Overview ¶
Package namedlocker implements in-memory named locks.
Example ¶
sto := Store{} sto.Lock("my-key") defer sto.Unlock("my-key") // do some work...
Output:
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is an in-memory store of named locks.
The zero-value is usable as-is.
func (*Store) Lock ¶
Lock acquires a lock on key. If key is locked, it blocks until it can be acquired.
func (*Store) TryUnlock ¶
TryUnlock releases the lock on key.
If key is not locked, ErrUnlockOfUnlockedKey is returned.
Click to show internal directories.
Click to hide internal directories.