User 'defer Unlock' to replace two 'Unlock's
Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>
This commit is contained in:
parent
12d65ceb50
commit
f59c7a87da
@ -70,13 +70,12 @@ func (m *Monitor) Start(c *exec.Cmd) error {
|
||||
ExitCh: make(chan int, 1),
|
||||
}
|
||||
m.Lock()
|
||||
defer m.Unlock()
|
||||
// start the process
|
||||
if err := rc.c.Start(); err != nil {
|
||||
m.Unlock()
|
||||
return err
|
||||
}
|
||||
m.cmds[rc.c.Process.Pid] = rc
|
||||
m.Unlock()
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user