mirror of
https://github.com/rclone/rclone.git
synced 2024-11-25 09:41:44 +08:00
cmount: use atomic types
This commit is contained in:
parent
123a030441
commit
50d0597d56
|
@ -30,7 +30,7 @@ type FS struct {
|
|||
ready chan (struct{})
|
||||
mu sync.Mutex // to protect the below
|
||||
handles []vfs.Handle
|
||||
destroyed int32 // read/write with sync/atomic
|
||||
destroyed atomic.Int32
|
||||
}
|
||||
|
||||
// NewFS makes a new FS
|
||||
|
@ -190,7 +190,7 @@ func (fsys *FS) Init() {
|
|||
// Destroy call).
|
||||
func (fsys *FS) Destroy() {
|
||||
defer log.Trace(fsys.f, "")("")
|
||||
atomic.StoreInt32(&fsys.destroyed, 1)
|
||||
fsys.destroyed.Store(1)
|
||||
}
|
||||
|
||||
// Getattr reads the attributes for path
|
||||
|
|
|
@ -13,7 +13,6 @@ import (
|
|||
"os"
|
||||
"runtime"
|
||||
"strings"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/rclone/rclone/cmd/mountlib"
|
||||
|
@ -192,7 +191,7 @@ func mount(VFS *vfs.VFS, mountPath string, opt *mountlib.Options) (<-chan error,
|
|||
// Shutdown the VFS
|
||||
fsys.VFS.Shutdown()
|
||||
var umountOK bool
|
||||
if atomic.LoadInt32(&fsys.destroyed) != 0 {
|
||||
if fsys.destroyed.Load() != 0 {
|
||||
fs.Debugf(nil, "Not calling host.Unmount as mount already Destroyed")
|
||||
umountOK = true
|
||||
} else if atexit.Signalled() {
|
||||
|
|
Loading…
Reference in New Issue
Block a user