{"modulePath":"github.com/hyperhq/hypercli","version":"v1.10.16","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package locker\n\nPackage locker provides a mechanism for creating finer-grained locking to help free up more global locks to handle other tasks.\n\nThe implementation looks close to a sync.Mutex, however the user must provide a reference to use to refer to the underlying lock when locking and unlocking, and unlock may generate an error.\n\nIf a lock with a given name does not exist when \\`Lock\\` is called, one is created. Lock references are automatically cleaned up on \\`Unlock\\` if nothing else is waiting for the lock.\n\n## Variables\n\n```go\nvar ErrNoSuchLock = errors.New(\"no such lock\")\n```\nErrNoSuchLock is returned when the requested lock does not exist\n\n## Types\n\n```go\ntype Locker struct {\n\t// contains filtered or unexported fields\n}\n```\nLocker provides a locking mechanism based on the passed in reference name\n\n```go\nfunc New() *Locker\n```\nNew creates a new Locker\n\n```go\nfunc (l *Locker) Lock(name string)\n```\nLock locks a mutex with the given name. If it doesn't exist, one is created\n\n```go\nfunc (l *Locker) Unlock(name string) error\n```\nUnlock unlocks the mutex with the given name If the given lock is not being waited on by any other callers, it is deleted\n\n","path":"github.com/hyperhq/hypercli/pkg/locker","name":"locker","synopsis":"Package locker provides a mechanism for creating finer-grained locking to help free up more global locks to handle other tasks.","isRedistributable":true}
