syncs: add Mutex/RWMutex alias/wrappers for future mutex debugging
Updates #17852 Change-Id: I477340fb8e40686870e981ade11cd61597c34a20 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
committed by
Brad Fitzpatrick
parent
3a41c0c585
commit
99b06eac49
@@ -9,6 +9,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"tailscale.com/syncs"
|
||||
"tailscale.com/util/set"
|
||||
"tailscale.com/util/syspolicy/internal/loggerx"
|
||||
"tailscale.com/util/syspolicy/pkey"
|
||||
@@ -70,7 +71,7 @@ func (c PolicyChange) HasChangedAnyOf(keys ...pkey.Key) bool {
|
||||
// policyChangeCallbacks are the callbacks to invoke when the effective policy changes.
|
||||
// It is safe for concurrent use.
|
||||
type policyChangeCallbacks struct {
|
||||
mu sync.Mutex
|
||||
mu syncs.Mutex
|
||||
cbs set.HandleSet[PolicyChangeCallback]
|
||||
}
|
||||
|
||||
|
||||
@@ -7,10 +7,10 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"slices"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"tailscale.com/syncs"
|
||||
"tailscale.com/util/syspolicy/internal/loggerx"
|
||||
"tailscale.com/util/syspolicy/setting"
|
||||
"tailscale.com/util/testenv"
|
||||
@@ -58,7 +58,7 @@ type Policy struct {
|
||||
|
||||
changeCallbacks policyChangeCallbacks
|
||||
|
||||
mu sync.Mutex
|
||||
mu syncs.Mutex
|
||||
watcherStarted bool // whether [Policy.watchReload] was started
|
||||
sources source.ReadableSources
|
||||
closing bool // whether [Policy.Close] was called (even if we're still closing)
|
||||
|
||||
@@ -10,7 +10,6 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"slices"
|
||||
"sync"
|
||||
|
||||
"tailscale.com/syncs"
|
||||
"tailscale.com/util/slicesx"
|
||||
@@ -20,7 +19,7 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
policyMu sync.Mutex // protects [policySources] and [effectivePolicies]
|
||||
policyMu syncs.Mutex // protects [policySources] and [effectivePolicies]
|
||||
policySources []*source.Source // all registered policy sources
|
||||
effectivePolicies []*Policy // all active (non-closed) effective policies returned by [PolicyFor]
|
||||
|
||||
|
||||
@@ -11,9 +11,9 @@ import (
|
||||
"fmt"
|
||||
"slices"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"tailscale.com/syncs"
|
||||
"tailscale.com/types/lazy"
|
||||
"tailscale.com/util/syspolicy/internal"
|
||||
"tailscale.com/util/syspolicy/pkey"
|
||||
@@ -215,7 +215,7 @@ type DefinitionMap map[pkey.Key]*Definition
|
||||
var (
|
||||
definitions lazy.SyncValue[DefinitionMap]
|
||||
|
||||
definitionsMu sync.Mutex
|
||||
definitionsMu syncs.Mutex
|
||||
definitionsList []*Definition
|
||||
definitionsUsed bool
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user