Merge pull request #658 from mheon/lock_to_interface

Replace sync.Mutex with sync.Locker to allow different locks
This commit is contained in:
Antonio Murdaca 2017-07-15 10:48:12 +02:00 committed by GitHub
commit 73c5285260
2 changed files with 4 additions and 2 deletions

View file

@ -37,7 +37,7 @@ type Container struct {
trusted bool trusted bool
state *ContainerState state *ContainerState
metadata *pb.ContainerMetadata metadata *pb.ContainerMetadata
opLock sync.Mutex opLock sync.Locker
// this is the /var/run/storage/... directory, erased on reboot // this is the /var/run/storage/... directory, erased on reboot
bundlePath string bundlePath string
// this is the /var/lib/storage/... directory // this is the /var/lib/storage/... directory
@ -79,6 +79,7 @@ func NewContainer(id string, name string, bundlePath string, logPath string, net
dir: dir, dir: dir,
state: state, state: state,
stopSignal: stopSignal, stopSignal: stopSignal,
opLock: new(sync.Mutex),
} }
return c, nil return c, nil
} }

View file

@ -57,7 +57,7 @@ type Server struct {
store sstorage.Store store sstorage.Store
storageImageServer storage.ImageServer storageImageServer storage.ImageServer
storageRuntimeServer storage.RuntimeServer storageRuntimeServer storage.RuntimeServer
stateLock sync.Mutex stateLock sync.Locker
updateLock sync.RWMutex updateLock sync.RWMutex
state *serverState state *serverState
netPlugin ocicni.CNIPlugin netPlugin ocicni.CNIPlugin
@ -589,6 +589,7 @@ func New(config *Config) (*Server, error) {
store: store, store: store,
storageImageServer: imageService, storageImageServer: imageService,
storageRuntimeServer: storageRuntimeService, storageRuntimeServer: storageRuntimeService,
stateLock: new(sync.Mutex),
netPlugin: netPlugin, netPlugin: netPlugin,
hostportManager: hostportManager, hostportManager: hostportManager,
config: *config, config: *config,