aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/gitea.com/lunny
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2021-08-16 04:52:26 +0800
committerGitHub <noreply@github.com>2021-08-15 22:52:26 +0200
commitf7a302ca6fba9889c8715b7115e757370c193dd9 (patch)
tree8080c95f572e2dd4c96e86f5dde9baeb5fc27698 /vendor/gitea.com/lunny
parentf5158b4304a4afe8b9542536805c155a3b604d62 (diff)
downloadgitea-f7a302ca6fba9889c8715b7115e757370c193dd9.tar.gz
gitea-f7a302ca6fba9889c8715b7115e757370c193dd9.zip
Upgrade levelqueue 0.4.1 (#16696)
Diffstat (limited to 'vendor/gitea.com/lunny')
-rw-r--r--vendor/gitea.com/lunny/levelqueue/queue.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/vendor/gitea.com/lunny/levelqueue/queue.go b/vendor/gitea.com/lunny/levelqueue/queue.go
index 948e019be8..328769d2bd 100644
--- a/vendor/gitea.com/lunny/levelqueue/queue.go
+++ b/vendor/gitea.com/lunny/levelqueue/queue.go
@@ -21,8 +21,8 @@ const (
// Queue defines a queue struct
type Queue struct {
db *leveldb.DB
- highLock sync.Mutex
- lowLock sync.Mutex
+ lowLock sync.Mutex // If you are locking both high and low locks, lock the low lock before the high lock
+ highLock sync.Mutex // If you are locking both high and low locks, lock the low lock before the high lock
low int64
high int64
lowKey []byte
@@ -295,10 +295,10 @@ func (queue *Queue) LHandle(h func([]byte) error) error {
// Close closes the queue (and the underlying db is set to closeUnderlyingDB)
func (queue *Queue) Close() error {
- queue.highLock.Lock()
queue.lowLock.Lock()
- defer queue.highLock.Unlock()
+ queue.highLock.Lock()
defer queue.lowLock.Unlock()
+ defer queue.highLock.Unlock()
if !queue.closeUnderlyingDB {
queue.db = nil