File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -666,6 +666,9 @@ func diffToDisk(bottom *diffLayer) *diskLayer {
666
666
667
667
// Release releases resources
668
668
func (t * Tree ) Release () {
669
+ t .lock .RLock ()
670
+ defer t .lock .RUnlock ()
671
+
669
672
if dl := t .disklayer (); dl != nil {
670
673
dl .Release ()
671
674
}
@@ -850,8 +853,8 @@ func (t *Tree) diskRoot() common.Hash {
850
853
// generating is an internal helper function which reports whether the snapshot
851
854
// is still under the construction.
852
855
func (t * Tree ) generating () (bool , error ) {
853
- t .lock .Lock ()
854
- defer t .lock .Unlock ()
856
+ t .lock .RLock ()
857
+ defer t .lock .RUnlock ()
855
858
856
859
layer := t .disklayer ()
857
860
if layer == nil {
@@ -864,8 +867,8 @@ func (t *Tree) generating() (bool, error) {
864
867
865
868
// DiskRoot is an external helper function to return the disk layer root.
866
869
func (t * Tree ) DiskRoot () common.Hash {
867
- t .lock .Lock ()
868
- defer t .lock .Unlock ()
870
+ t .lock .RLock ()
871
+ defer t .lock .RUnlock ()
869
872
870
873
return t .diskRoot ()
871
874
}
You can’t perform that action at this time.
0 commit comments