Files
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>grafanabotJennie Pham
2ff833f062 Bump go.opentelemetry.io/collector/processor from 0.89.0 to 0.94.1 (#3379)
* Bump go.opentelemetry.io/collector/processor from 0.89.0 to 0.94.1

Bumps [go.opentelemetry.io/collector/processor](https://github.com/open-telemetry/opentelemetry-collector) from 0.89.0 to 0.94.1.
- [Release notes](https://github.com/open-telemetry/opentelemetry-collector/releases)
- [Changelog](https://github.com/open-telemetry/opentelemetry-collector/blob/main/CHANGELOG-API.md)
- [Commits](https://github.com/open-telemetry/opentelemetry-collector/compare/v0.89.0...v0.94.1)

---
updated-dependencies:
- dependency-name: go.opentelemetry.io/collector/processor
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* Update serverless gomod

* vendor update

* Update serverless gomod

* delete this file

* add it back

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: grafanabot <[email protected]>
Co-authored-by: Jennie Pham <[email protected]>
2024-02-27 11:01:23 -06:00

53 lines
1.4 KiB
Go

package conc
import (
"sync"
"github.com/sourcegraph/conc/panics"
)
// NewWaitGroup creates a new WaitGroup.
func NewWaitGroup() *WaitGroup {
return &WaitGroup{}
}
// WaitGroup is the primary building block for scoped concurrency.
// Goroutines can be spawned in the WaitGroup with the Go method,
// and calling Wait() will ensure that each of those goroutines exits
// before continuing. Any panics in a child goroutine will be caught
// and propagated to the caller of Wait().
//
// The zero value of WaitGroup is usable, just like sync.WaitGroup.
// Also like sync.WaitGroup, it must not be copied after first use.
type WaitGroup struct {
wg sync.WaitGroup
pc panics.Catcher
}
// Go spawns a new goroutine in the WaitGroup.
func (h *WaitGroup) Go(f func()) {
h.wg.Add(1)
go func() {
defer h.wg.Done()
h.pc.Try(f)
}()
}
// Wait will block until all goroutines spawned with Go exit and will
// propagate any panics spawned in a child goroutine.
func (h *WaitGroup) Wait() {
h.wg.Wait()
// Propagate a panic if we caught one from a child goroutine.
h.pc.Repanic()
}
// WaitAndRecover will block until all goroutines spawned with Go exit and
// will return a *panics.Recovered if one of the child goroutines panics.
func (h *WaitGroup) WaitAndRecover() *panics.Recovered {
h.wg.Wait()
// Return a recovered panic if we caught one from a child goroutine.
return h.pc.Recovered()
}