diff options
| author | Dmitriy Vyukov <dvyukov@google.com> | 2014-03-14 21:21:44 +0400 |
|---|---|---|
| committer | Dmitriy Vyukov <dvyukov@google.com> | 2014-03-14 21:21:44 +0400 |
| commit | 0da73b9f073b2b1e9b78b3a6f6bc077101a05658 (patch) | |
| tree | 88b5ab80c462af4284921de060bb3a523f8fa5b7 /src | |
| parent | b8d40172ce2a724ecb125746f37aee989ced5ac9 (diff) | |
| download | go-0da73b9f073b2b1e9b78b3a6f6bc077101a05658.tar.xz | |
runtime: fix a race in bgsweep
See the comment for description.
LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/75670044
Diffstat (limited to 'src')
| -rw-r--r-- | src/pkg/runtime/mgc0.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/pkg/runtime/mgc0.c b/src/pkg/runtime/mgc0.c index 65e51e4d1f..f9d6face09 100644 --- a/src/pkg/runtime/mgc0.c +++ b/src/pkg/runtime/mgc0.c @@ -1906,6 +1906,12 @@ bgsweep(void) runtime·ready(fing); } } + if(!runtime·mheap.sweepdone) { + // It's possible if GC has happened between sweepone has + // returned -1 and gclock lock. + runtime·unlock(&gclock); + continue; + } sweep.parked = true; runtime·parkunlock(&gclock, "GC sweep wait"); } |
