TODO: defer workaround, should remove after fix

This commit is contained in:
Li Jie
2025-04-11 17:14:26 +08:00
parent 5a13e7400e
commit 19b98393a6
4 changed files with 10 additions and 4 deletions

View File

@@ -380,7 +380,7 @@ func (m *Map) CompareAndSwap(key, old, new any) bool {
}
m.mu.Lock()
defer m.mu.Unlock()
//TODO(lijie): workaround for defer crash on wasm
read = m.loadReadOnly()
swapped := false
if e, ok := read.m[key]; ok {
@@ -395,6 +395,7 @@ func (m *Map) CompareAndSwap(key, old, new any) bool {
// more efficient steady state.
m.missLocked()
}
m.mu.Unlock()
return swapped
}