vendor: golang.org/x/sync 6e8e738ad208923de99951fe0b48239bfd864f28
full diff: cd5d95a43a...6e8e738ad2
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
e538720da7
commit
928227a456
2 changed files with 11 additions and 2 deletions
|
@ -30,7 +30,7 @@ github.com/syndtr/gocapability 42c35b4376354fd554efc7ad35e0
|
|||
|
||||
github.com/RackSec/srslog a4725f04ec91af1a91b380da679d6e0c2f061e59
|
||||
github.com/imdario/mergo 1afb36080aec31e0d1528973ebe6721b191b0369 # v0.3.8
|
||||
golang.org/x/sync cd5d95a43a6e21273425c7ae415d3df9ea832eeb
|
||||
golang.org/x/sync 6e8e738ad208923de99951fe0b48239bfd864f28
|
||||
|
||||
# buildkit
|
||||
github.com/moby/buildkit 9065b18ba4633c75862befca8188de4338d9f94a # v0.8.2
|
||||
|
|
11
vendor/golang.org/x/sync/semaphore/semaphore.go
generated
vendored
11
vendor/golang.org/x/sync/semaphore/semaphore.go
generated
vendored
|
@ -67,7 +67,12 @@ func (s *Weighted) Acquire(ctx context.Context, n int64) error {
|
|||
// fix up the queue, just pretend we didn't notice the cancelation.
|
||||
err = nil
|
||||
default:
|
||||
isFront := s.waiters.Front() == elem
|
||||
s.waiters.Remove(elem)
|
||||
// If we're at the front and there're extra tokens left, notify other waiters.
|
||||
if isFront && s.size > s.cur {
|
||||
s.notifyWaiters()
|
||||
}
|
||||
}
|
||||
s.mu.Unlock()
|
||||
return err
|
||||
|
@ -97,6 +102,11 @@ func (s *Weighted) Release(n int64) {
|
|||
s.mu.Unlock()
|
||||
panic("semaphore: released more than held")
|
||||
}
|
||||
s.notifyWaiters()
|
||||
s.mu.Unlock()
|
||||
}
|
||||
|
||||
func (s *Weighted) notifyWaiters() {
|
||||
for {
|
||||
next := s.waiters.Front()
|
||||
if next == nil {
|
||||
|
@ -123,5 +133,4 @@ func (s *Weighted) Release(n int64) {
|
|||
s.waiters.Remove(next)
|
||||
close(w.ready)
|
||||
}
|
||||
s.mu.Unlock()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue