]> Cypherpunks repositories - gostls13.git/commit
runtime, internal/synctest, sync: associate WaitGroups with bubbles
authorDamien Neil <dneil@google.com>
Tue, 20 May 2025 22:56:43 +0000 (15:56 -0700)
committerGopher Robot <gobot@golang.org>
Thu, 29 May 2025 17:26:00 +0000 (10:26 -0700)
commitb170c7e94c478e616d194af95caa7747d9fa4725
treeb77064b4707cc99d60d3727ba62a8fbc1a16ee25
parent3b77085b40bf0d53528d6852d07c00c81021c855
runtime, internal/synctest, sync: associate WaitGroups with bubbles

Add support to internal/synctest for managing associations between
arbitrary pointers and synctest bubbles. (Implemented internally to
the runtime package by attaching a special to the pointer.)

Associate WaitGroups with bubbles.
Since WaitGroups don't have a constructor,
perform the association when Add is called.
All Add calls must be made from within the same bubble,
or outside any bubble.

When a bubbled goroutine calls WaitGroup.Wait,
the wait is durably blocking iff the WaitGroup is associated
with the current bubble.

Change-Id: I77e2701e734ac2fa2b32b28d5b0c853b7b2825c9
Reviewed-on: https://go-review.googlesource.com/c/go/+/676656
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Damien Neil <dneil@google.com>
src/go/build/deps_test.go
src/internal/synctest/synctest.go
src/internal/synctest/synctest_test.go
src/runtime/mheap.go
src/runtime/runtime2.go
src/runtime/sema.go
src/runtime/synctest.go
src/sync/runtime.go
src/sync/waitgroup.go
src/testing/synctest/synctest.go