MCPcopy
hub / github.com/wavetermdev/waveterm / SetUnless

Method SetUnless

pkg/util/ds/syncmap.go:45–53  ·  view source on GitHub ↗
(key string, value T)

Source from the content-addressed store, hash-verified

43}
44
45func (sm *SyncMap[T]) SetUnless(key string, value T) bool {
46 sm.lock.Lock()
47 defer sm.lock.Unlock()
48 if _, exists := sm.m[key]; exists {
49 return false
50 }
51 sm.m[key] = value
52 return true
53}
54
55func (sm *SyncMap[T]) TestAndSet(key string, newValue T, testFn func(T, bool) bool) bool {
56 sm.lock.Lock()

Callers 1

RunAIChatFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected