Browse Source

Reorder locking to avoid deadlock (fixes #64)

Jakob Borg 11 years ago
parent
commit
c171780c0d
1 changed files with 2 additions and 2 deletions
  1. 2 2
      filequeue.go

+ 2 - 2
filequeue.go

@@ -220,10 +220,10 @@ func (q *FileQueue) SetAvailable(file string, nodes []string) {
 }
 
 func (q *FileQueue) RemoveAvailable(toRemove string) {
-	q.amut.Lock()
 	q.fmut.Lock()
-	defer q.fmut.Unlock()
+	q.amut.Lock()
 	defer q.amut.Unlock()
+	defer q.fmut.Unlock()
 
 	for file, nodes := range q.availability {
 		for i, node := range nodes {