diff options
| author | Changkun Ou <hi@changkun.us> | 2020-08-24 13:45:27 +0200 |
|---|---|---|
| committer | Bryan C. Mills <bcmills@google.com> | 2020-08-24 20:05:41 +0000 |
| commit | 94953d3e5928c8a577bad7911aabbf627269ef77 (patch) | |
| tree | 815794b61cee10f76b4678232d80d19e58bf1c47 /src/sync/map.go | |
| parent | bb998747d6c5213e3a366936c482e149dce62720 (diff) | |
| download | go-94953d3e5928c8a577bad7911aabbf627269ef77.tar.xz | |
sync: delete dirty keys inside Map.LoadAndDelete
Fixes #40999
Change-Id: Ie32427e5cb5ed512b976b554850f50be156ce9f2
Reviewed-on: https://go-review.googlesource.com/c/go/+/250197
Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Diffstat (limited to 'src/sync/map.go')
| -rw-r--r-- | src/sync/map.go | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/sync/map.go b/src/sync/map.go index a61e2ebdd6..9ad25353ff 100644 --- a/src/sync/map.go +++ b/src/sync/map.go @@ -274,6 +274,7 @@ func (m *Map) LoadAndDelete(key interface{}) (value interface{}, loaded bool) { e, ok = read.m[key] if !ok && read.amended { e, ok = m.dirty[key] + delete(m.dirty, key) // Regardless of whether the entry was present, record a miss: this key // will take the slow path until the dirty map is promoted to the read // map. |
