all: use syncs.AtomicValue

Signed-off-by: Maisem Ali <maisem@tailscale.com>
This commit is contained in:
Maisem Ali
2022-08-04 10:43:49 -07:00
committed by Maisem Ali
parent b75f81ec00
commit a9f6cd41fd
23 changed files with 97 additions and 101 deletions

View File

@@ -8,10 +8,10 @@ import (
"fmt"
"os"
"path/filepath"
"sync/atomic"
"golang.org/x/sys/windows"
"golang.org/x/sys/windows/registry"
"tailscale.com/syncs"
"tailscale.com/util/winutil"
)
@@ -20,10 +20,10 @@ func init() {
packageType = packageTypeWindows
}
var winVerCache atomic.Value // of string
var winVerCache syncs.AtomicValue[string]
func osVersionWindows() string {
if s, ok := winVerCache.Load().(string); ok {
if s, ok := winVerCache.LoadOk(); ok {
return s
}
major, minor, build := windows.RtlGetNtVersionNumbers()