MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / GetOrCreate

Method GetOrCreate

pkg/util/ds/syncmap.go:66–75  ·  view source on GitHub ↗
(key string, createFn func() T)

Source from the content-addressed store, hash-verified

64}
65
66func (sm *SyncMap[T]) GetOrCreate(key string, createFn func() T) T {
67 sm.lock.Lock()
68 defer sm.lock.Unlock()
69 if v, ok := sm.m[key]; ok {
70 return v
71 }
72 v := createFn()
73 sm.m[key] = v
74 return v
75}

Callers 1

getBlockResyncMutexFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected