mirror of
https://github.com/clearlinux/libnetwork.git
synced 2026-08-27 11:16:55 +00:00
Fix miscellaneaus data races
Fixed the remaining data races in the libnetwork code. Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
This commit is contained in:
committed by
Madhu Venugopal
parent
0a81ebd745
commit
a031640ea0
@@ -64,14 +64,23 @@ type network struct {
|
||||
}
|
||||
|
||||
func (n *network) Name() string {
|
||||
n.Lock()
|
||||
defer n.Unlock()
|
||||
|
||||
return n.name
|
||||
}
|
||||
|
||||
func (n *network) ID() string {
|
||||
n.Lock()
|
||||
defer n.Unlock()
|
||||
|
||||
return string(n.id)
|
||||
}
|
||||
|
||||
func (n *network) Type() string {
|
||||
n.Lock()
|
||||
defer n.Unlock()
|
||||
|
||||
if n.driver == nil {
|
||||
return ""
|
||||
}
|
||||
|
||||
@@ -52,7 +52,11 @@ func createBasePath() {
|
||||
}
|
||||
|
||||
func removeUnusedPaths() {
|
||||
for range time.Tick(gpmCleanupPeriod) {
|
||||
gpmLock.Lock()
|
||||
period := gpmCleanupPeriod
|
||||
gpmLock.Unlock()
|
||||
|
||||
for range time.Tick(period) {
|
||||
gpmLock.Lock()
|
||||
pathList := make([]string, 0, len(garbagePathMap))
|
||||
for path := range garbagePathMap {
|
||||
|
||||
@@ -33,7 +33,9 @@ func newKey(t *testing.T) (string, error) {
|
||||
}
|
||||
|
||||
// Set the rpmCleanupPeriod to be low to make the test run quicker
|
||||
gpmLock.Lock()
|
||||
gpmCleanupPeriod = 2 * time.Second
|
||||
gpmLock.Unlock()
|
||||
|
||||
return name, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user