Skip to content

Commit

Permalink
Uses clear() for atomic map too
Browse files Browse the repository at this point in the history
Signed-off-by: Elena Kolevska <[email protected]>
  • Loading branch information
elena-kolevska committed May 21, 2024
1 parent cf6ab26 commit 8e24aad
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion concurrency/atomicmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,5 +107,5 @@ func (a *atomicMap[K, T]) ForEach(fn func(key K, value *AtomicValue[T])) {
func (a *atomicMap[K, T]) Clear() {
a.lock.Lock()
defer a.lock.Unlock()
a.items = make(map[K]*AtomicValue[T])
clear(a.items)
}

0 comments on commit 8e24aad

Please sign in to comment.