sync/errgroup: improve documentation for semaphore limit behavior
Updated the documentation for `SetLimit` and `Go` functions in the `errgroup` package. the note clarifies the behavior when the semaphore limit is set to zero, which could lead to a deadlock if not handled properly. the updated documentation warns users to set a positive semaphore limit to avoid blocking goroutines and potential deadlock this change improves the clarity of API and helps users understand how to properly use the semaphore limit to prevent issues in concurrent execution Change-Id: Ie62acc38ef804b3590c04bddba00a3cce21e8cef Reviewed-on: https://go-review.googlesource.com/c/sync/+/642215 Reviewed-by: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com>
This commit is contained in:
parent
913fb63af2
commit
fe3591bd8a
1 changed files with 1 additions and 0 deletions
|
|
@ -118,6 +118,7 @@ func (g *Group) TryGo(f func() error) bool {
|
|||
|
||||
// SetLimit limits the number of active goroutines in this group to at most n.
|
||||
// A negative value indicates no limit.
|
||||
// A limit of zero will prevent any new goroutines from being added.
|
||||
//
|
||||
// Any subsequent call to the Go method will block until it can add an active
|
||||
// goroutine without exceeding the configured limit.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue