aboutsummaryrefslogtreecommitdiff
path: root/weed/util/bounded_tree/bounded_tree.go
diff options
context:
space:
mode:
Diffstat (limited to 'weed/util/bounded_tree/bounded_tree.go')
-rw-r--r--weed/util/bounded_tree/bounded_tree.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/weed/util/bounded_tree/bounded_tree.go b/weed/util/bounded_tree/bounded_tree.go
index 40b9c4e47..0e023c0d1 100644
--- a/weed/util/bounded_tree/bounded_tree.go
+++ b/weed/util/bounded_tree/bounded_tree.go
@@ -15,7 +15,7 @@ type Node struct {
type BoundedTree struct {
root *Node
- sync.Mutex
+ sync.RWMutex
}
func NewBoundedTree() *BoundedTree {
@@ -131,6 +131,9 @@ func (n *Node) getChild(childName string) *Node {
func (t *BoundedTree) HasVisited(p util.FullPath) bool {
+ t.RLock()
+ defer t.RUnlock()
+
if t.root == nil {
return true
}