github.com/kaisenlinux/docker.io@v0.0.0-20230510090727-ea55db55fac7/engine/pkg/locker/locker.go (about) 1 /* 2 Package locker provides a mechanism for creating finer-grained locking to help 3 free up more global locks to handle other tasks. 4 5 The implementation looks close to a sync.Mutex, however the user must provide a 6 reference to use to refer to the underlying lock when locking and unlocking, 7 and unlock may generate an error. 8 9 If a lock with a given name does not exist when `Lock` is called, one is 10 created. 11 Lock references are automatically cleaned up on `Unlock` if nothing else is 12 waiting for the lock. 13 */ 14 package locker // import "github.com/docker/docker/pkg/locker" 15 16 import ( 17 "github.com/moby/locker" 18 ) 19 20 // ErrNoSuchLock is returned when the requested lock does not exist 21 // Deprecated: use github.com/moby/locker.ErrNoSuchLock 22 var ErrNoSuchLock = locker.ErrNoSuchLock 23 24 // Locker provides a locking mechanism based on the passed in reference name 25 // Deprecated: use github.com/moby/locker.Locker 26 type Locker = locker.Locker 27 28 // New creates a new Locker 29 // Deprecated: use github.com/moby/locker.New 30 var New = locker.New