tailscale/syncs
Joe Tsai e68efa5e9f syncs: add Map.WithLock to allow mutations to the underlying map
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>
2023-06-20 13:44:06 -07:00
..
locked.go all: update copyright and license headers 2023-01-27 15:36:29 -08:00
locked_test.go all: update copyright and license headers 2023-01-27 15:36:29 -08:00
syncs.go syncs: add Map.WithLock to allow mutations to the underlying map 2023-06-20 13:44:06 -07:00
syncs_test.go syncs: add Map.WithLock to allow mutations to the underlying map 2023-06-20 13:44:06 -07:00
watchdog.go all: update copyright and license headers 2023-01-27 15:36:29 -08:00
watchdog_test.go syncs: relax TestWatchMultipleValues timing on Windows 2023-04-19 19:00:34 -07:00