提交 bc33f9b1 编写于 作者: H Helin Wang

fix bug lock is released too soon

上级 4808e22e
......@@ -110,7 +110,7 @@ func (s *Service) SendGrads(grads []Gradient, dummy *int) error {
}
s.mu.Lock()
s.mu.Unlock()
defer s.mu.Unlock()
for _, g := range grads {
if _, ok := s.paramMap[g.Name]; !ok {
......@@ -134,7 +134,7 @@ func (s *Service) SendGrads(grads []Gradient, dummy *int) error {
func (s *Service) GetParams(names []string, parameters *[]Parameter) error {
<-s.initialized
s.mu.Lock()
s.mu.Unlock()
defer s.mu.Unlock()
for _, n := range names {
if _, ok := s.paramMap[n]; !ok {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册