Skip to content

Tags: golang/sync

Tags

v0.7.0

Toggle v0.7.0's commit message
semaphore: cancel acquisition with a done context

When acquiring from a semaphore could proceed without contention, the
previous behavior was to always do so, even when the provided context
was done. This was the documented behavior, but it could lead to
confusion. It isn't much more expensive to check the context error, so
cancel acquisition if it's done.

Fixes golang/go#63615.

goos: linux
goarch: amd64
pkg: golang.org/x/sync/semaphore
cpu: 12th Gen Intel(R) Core(TM) i5-1235U
                                        │  old.bench  │             new.bench              │
                                        │   sec/op    │   sec/op     vs base               │
AcquireSeq/Weighted-acquire-1-1-1-12      26.45n ± 2%   27.25n ± 3%  +3.04% (p=0.001 n=20)
AcquireSeq/Weighted-acquire-2-1-1-12      26.96n ± 1%   27.12n ± 1%       ~ (p=0.104 n=20)
AcquireSeq/Weighted-acquire-16-1-1-12     26.07n ± 3%   27.48n ± 1%  +5.45% (p=0.000 n=20)
AcquireSeq/Weighted-acquire-128-1-1-12    26.19n ± 2%   27.24n ± 1%  +4.01% (p=0.000 n=20)
AcquireSeq/Weighted-acquire-2-2-1-12      25.61n ± 1%   25.99n ± 2%       ~ (p=0.066 n=20)
AcquireSeq/Weighted-acquire-16-2-8-12     209.6n ± 2%   211.0n ± 3%       ~ (p=0.280 n=20)
AcquireSeq/Weighted-acquire-128-2-64-12   1.669µ ± 1%   1.721µ ± 2%  +3.09% (p=0.000 n=20)
AcquireSeq/Weighted-acquire-2-1-2-12      51.08n ± 1%   53.03n ± 2%  +3.82% (p=0.000 n=20)
AcquireSeq/Weighted-acquire-16-8-2-12     52.48n ± 2%   53.66n ± 2%  +2.26% (p=0.028 n=20)
AcquireSeq/Weighted-acquire-128-64-2-12   52.27n ± 1%   53.71n ± 2%  +2.75% (p=0.000 n=20)
geomean                                   60.06n        61.69n       +2.71%

Change-Id: I0ae1a0bb6c027461ac1a9ee71c51efd8427ab308
Reviewed-on: https://go-review.googlesource.com/c/sync/+/536275
Auto-Submit: Bryan Mills <[email protected]>
Reviewed-by: Bryan Mills <[email protected]>
Reviewed-by: Michael Knyszek <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>

v0.6.0

Toggle v0.6.0's commit message
errgroup: add reference to sync.WaitGroup

Add doc link to sync.WaitGroup in the package documentation.

Rationale:
The reference to sync.WaitGroup might be obvious to the authors of this
package, but it wasn't to me, so despites I had seen this package
multiple times I had never made the link to sync.WaitGroup. So when
playing with WaitGroup I was missing remembering about errgroup.
In hope this will help others as well as my future self.

Change-Id: I2c56976958ad9ab94c1596c96fa86c00dd73d2fb
Reviewed-on: https://go-review.googlesource.com/c/sync/+/538335
Reviewed-by: Bryan Mills <[email protected]>
Reviewed-by: Carlos Amedee <[email protected]>
Auto-Submit: Bryan Mills <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>

v0.5.0

Toggle v0.5.0's commit message
all: update go directive to 1.18

Done with:

go get [email protected]
go mod tidy
go fix ./...

Using go1.21.3.

While here, simplify package syncmap by taking advantage of knowing
that all supported Go versions will have the go1.9 build constraint
satisfied.

For golang/go#60268.

Change-Id: Ic0f24ab13ada6839573e55beee5516c1a6c7f3cc
Reviewed-on: https://go-review.googlesource.com/c/sync/+/534220
Auto-Submit: Dmitri Shuralyov <[email protected]>
Reviewed-by: Ian Lance Taylor <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
Reviewed-by: Dmitri Shuralyov <[email protected]>

v0.4.0

Toggle v0.4.0's commit message
singleflight: add panicError.Unwrap method

Currently when singleflight recovers from a panic, it wraps it with the private
error type panicError. This change adds an `Unwrap` method to panicError to
allow wrapped errors to be returned.

Updates golang/go#62511

Change-Id: Ia510ad7d5881207ef71f9eb89c1766835af19b6b
Reviewed-on: https://go-review.googlesource.com/c/sync/+/526171
Auto-Submit: Bryan Mills <[email protected]>
Reviewed-by: Than McIntosh <[email protected]>
Reviewed-by: Bryan Mills <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>

v0.3.0

Toggle v0.3.0's commit message
errgroup: use WithCancelCause to cancel context

Fixes golang/go#59355

Change-Id: Ib6a88e7e5fefe7b0d5672035af16d109aabcbf1e
Reviewed-on: https://go-review.googlesource.com/c/sync/+/481255
TryBot-Result: Gopher Robot <[email protected]>
Run-TryBot: Bryan Mills <[email protected]>
Reviewed-by: Bryan Mills <[email protected]>
Run-TryBot: Ian Lance Taylor <[email protected]>
Reviewed-by: Michael Knyszek <[email protected]>
Auto-Submit: Bryan Mills <[email protected]>

v0.2.0

Toggle v0.2.0's commit message
singleflight: make the check for exec support in TestPanicDoChan plat…

…form-agnostic

The new wasip1 GOOS does not support exec, but some ios environments
(like Corellium) might. Update the test to exec itself with -test.list
as a control case.

For golang/go#58141.

Change-Id: Id69950fc394910620f6c73cb437ca75c09ad8c29
Reviewed-on: https://go-review.googlesource.com/c/sync/+/485980
Run-TryBot: Bryan Mills <[email protected]>
Commit-Queue: Bryan Mills <[email protected]>
Reviewed-by: Dmitri Shuralyov <[email protected]>
Auto-Submit: Bryan Mills <[email protected]>
Reviewed-by: Johan Brandhorst-Satzkorn <[email protected]>
TryBot-Result: Gopher Robot <[email protected]>
Reviewed-by: Dmitri Shuralyov <[email protected]>

v0.1.0

Toggle v0.1.0's commit message
singleflight: avoid race between multiple Do calls

This is port of CL 436437, but without the test. ForgotUnshared has not
been ported here yet.

Change-Id: Id54d0c41d1a7948bf008e458c44b21670ada81e4
Reviewed-on: https://go-review.googlesource.com/c/sync/+/436495
Run-TryBot: Cuong Manh Le <[email protected]>
Reviewed-by: Bryan Mills <[email protected]>
TryBot-Result: Gopher Robot <[email protected]>
Auto-Submit: Cuong Manh Le <[email protected]>
Reviewed-by: Dmitri Shuralyov <[email protected]>