Add missing locks around broadcasts

Signed-off-by: Mark Gordon <msg555@gmail.com>
docker-19.03
msg 2019-05-09 17:33:48 -04:00 committed by Mark Gordon
parent 646fc0af6d
commit 78a8e643f6
4 changed files with 10 additions and 0 deletions

View File

@ -63,7 +63,9 @@ func (gwf *GatewayForwarder) lookupForwarder(ctx context.Context) (gateway.LLBBr
go func() {
<-ctx.Done()
gwf.mu.Lock()
gwf.updateCond.Broadcast()
gwf.mu.Unlock()
}()
gwf.mu.RLock()

View File

@ -162,7 +162,9 @@ func (sm *Manager) Get(ctx context.Context, id string) (Caller, error) {
go func() {
select {
case <-ctx.Done():
sm.mu.Lock()
sm.updateCondition.Broadcast()
sm.mu.Unlock()
}
}()

View File

@ -404,7 +404,9 @@ func (jl *Solver) Get(id string) (*Job, error) {
go func() {
<-ctx.Done()
jl.mu.Lock()
jl.updateCond.Broadcast()
jl.mu.Unlock()
}()
jl.mu.RLock()

View File

@ -101,7 +101,9 @@ func (pr *progressReader) Read(ctx context.Context) ([]*Progress, error) {
select {
case <-done:
case <-ctx.Done():
pr.mu.Lock()
pr.cond.Broadcast()
pr.mu.Unlock()
}
}()
pr.mu.Lock()
@ -163,7 +165,9 @@ func pipe() (*progressReader, *progressWriter, func()) {
pr.cond = sync.NewCond(&pr.mu)
go func() {
<-ctx.Done()
pr.mu.Lock()
pr.cond.Broadcast()
pr.mu.Unlock()
}()
pw := &progressWriter{
reader: pr,