diff options
| author | Joe Tsai <joetsai@digital-static.net> | 2024-07-11 16:16:30 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-11 16:16:30 -0700 |
| commit | d209b032abbc5f86301d296e1919abdc302e3cfc (patch) | |
| tree | ee8c15bc639226f6945b4c30ae619be5f526bf45 /control/controlknobs/controlknobs.go | |
| parent | fc28c8e7f39d83e75dfd6009c789c0a9739ba9bd (diff) | |
| download | tailscale-d209b032abbc5f86301d296e1919abdc302e3cfc.tar.xz tailscale-d209b032abbc5f86301d296e1919abdc302e3cfc.zip | |
syncs: add Map.WithLock to allow mutations to the underlying map (#8101)
Some operations cannot be implemented with the prior API:
* Iterating over the map and deleting keys
* Iterating over the map and replacing items
* Calling APIs that expect a native Go map
Add a Map.WithLock method that acquires a write-lock on the map
and then calls a user-provided closure with the underlying Go map.
This allows users to interact with the Map as a regular Go map,
but with the gaurantees that it is concurrent safe.
Updates tailscale/corp#9115
Signed-off-by: Joe Tsai <joetsai@digital-static.net>
Diffstat (limited to 'control/controlknobs/controlknobs.go')
0 files changed, 0 insertions, 0 deletions
