summaryrefslogtreecommitdiffhomepage
path: root/syncs/mutex.go
diff options
context:
space:
mode:
authorBrad Fitzpatrick <bradfitz@tailscale.com>2025-12-02 12:50:33 -0800
committerBrad Fitzpatrick <bradfitz@tailscale.com>2025-12-02 15:12:13 -0800
commit381de776c4878dd9af76b126cfa37bc80cad363f (patch)
treec3ddcbf9613db3074c9c6882bb757357cf5bdd0a /syncs/mutex.go
parentb8c58ca7c1a49fb772d095c65693cdab06488047 (diff)
downloadtailscale-bradfitz/mutex_debug.tar.xz
tailscale-bradfitz/mutex_debug.zip
syncs: start working on mutex debugging, registrationbradfitz/mutex_debug
Updates #17852 Change-Id: Ib1b634eedd30cc4006bc1b39aa8d479d37c5f1f2 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
Diffstat (limited to 'syncs/mutex.go')
-rw-r--r--syncs/mutex.go16
1 files changed, 15 insertions, 1 deletions
diff --git a/syncs/mutex.go b/syncs/mutex.go
index 8034e1712..78342ffc9 100644
--- a/syncs/mutex.go
+++ b/syncs/mutex.go
@@ -7,6 +7,10 @@ package syncs
import "sync"
+// MutexDebugging indicates whether the "ts_mutex_debug" build tag is set
+// and mutex debugging is enabled.
+const MutexDebugging = false
+
// Mutex is an alias for sync.Mutex.
//
// It's only not a sync.Mutex when built with the ts_mutex_debug build tag.
@@ -20,4 +24,14 @@ type RWMutex = sync.RWMutex
// RequiresMutex declares the caller assumes it has the given
// mutex held. In non-debug builds, it's a no-op and compiles to
// nothing.
-func RequiresMutex(mu *sync.Mutex) {}
+func RequiresMutex(mu *Mutex) {}
+
+func RegisterMutex(mu *Mutex, name string) {}
+
+// ForkJoinGo is like go fn() but indicates that the goroutine
+// is part of a fork-join parallelism pattern.
+//
+// This compiles to just "go fn()" in non-debug builds.
+func ForkJoinGo(fn func()) {
+ go fn()
+}