vendor: update buildkit to 8effd45b

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
Tonis Tiigi
2021-03-22 15:23:46 -07:00
parent 28809b82a2
commit d40a6082fa
618 changed files with 75150 additions and 10913 deletions

View File

@ -130,7 +130,11 @@ func (c *call) wait(ctx context.Context) (v interface{}, err error) {
c.mu.Lock()
// detect case where caller has just returned, let it clean up before
select {
case <-c.ready: // could return if no error
case <-c.ready:
c.mu.Unlock()
<-c.cleaned
return nil, errRetry
case <-c.ctx.done: // could return if no error
c.mu.Unlock()
<-c.cleaned
return nil, errRetry
@ -141,6 +145,10 @@ func (c *call) wait(ctx context.Context) (v interface{}, err error) {
if ok {
c.progressState.add(pw)
}
ctx, cancel := context.WithCancel(ctx)
defer cancel()
c.ctxs = append(c.ctxs, ctx)
c.mu.Unlock()
@ -149,18 +157,16 @@ func (c *call) wait(ctx context.Context) (v interface{}, err error) {
select {
case <-ctx.Done():
select {
case <-c.ctx.Done():
if c.ctx.checkDone() {
// if this cancelled the last context, then wait for function to shut down
// and don't accept any more callers
<-c.ready
return c.result, c.err
default:
if ok {
c.progressState.close(pw)
}
return nil, ctx.Err()
}
if ok {
c.progressState.close(pw)
}
return nil, ctx.Err()
case <-c.ready:
return c.result, c.err // shared not implemented yet
}
@ -183,9 +189,6 @@ func (c *call) Deadline() (deadline time.Time, ok bool) {
}
func (c *call) Done() <-chan struct{} {
c.mu.Lock()
c.ctx.signal()
c.mu.Unlock()
return c.ctx.done
}
@ -238,23 +241,28 @@ func newContext(c *call) *sharedContext {
return &sharedContext{call: c, done: make(chan struct{})}
}
// call with lock
func (c *sharedContext) signal() {
func (sc *sharedContext) checkDone() bool {
sc.mu.Lock()
select {
case <-c.done:
case <-sc.done:
sc.mu.Unlock()
return true
default:
var err error
for _, ctx := range c.ctxs {
select {
case <-ctx.Done():
err = ctx.Err()
default:
return
}
}
c.err = err
close(c.done)
}
var err error
for _, ctx := range sc.ctxs {
select {
case <-ctx.Done():
err = ctx.Err()
default:
sc.mu.Unlock()
return false
}
}
sc.err = err
close(sc.done)
sc.mu.Unlock()
return true
}
type rawProgressWriter interface {