diff options
author | Russ Cox <rsc@golang.org> | 2014-02-27 22:43:34 -0500 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2014-02-27 22:43:34 -0500 |
commit | 8632586cdc31ae61d0d7ef0ca7f13f7d481a9bfa (patch) | |
tree | b721ec96726f18a4856030f25ab5480e1c43df5b | |
parent | 5b1f5b3efb2d9ddfa962e114b46e9be6c0e2fe52 (diff) | |
download | go-8632586cdc31ae61d0d7ef0ca7f13f7d481a9bfa.tar.gz |
[release-branch.go1.2] runtime: fix data race in GC
??? CL 52090045 / 302bdb5b08b1
runtime: fix data race in GC
Fixes issue 5139.
Update issue 7065.
R=golang-codereviews, bradfitz, minux.ma
CC=golang-codereviews
https://codereview.appspot.com/52090045
???
LGTM=r
R=golang-codereviews, r
CC=golang-dev
https://codereview.appspot.com/69790043
-rw-r--r-- | src/pkg/runtime/mgc0.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/pkg/runtime/mgc0.c b/src/pkg/runtime/mgc0.c index 4b2108ba7..761f128a8 100644 --- a/src/pkg/runtime/mgc0.c +++ b/src/pkg/runtime/mgc0.c @@ -1798,6 +1798,8 @@ runtime·memorydump(void) void runtime·gchelper(void) { + int32 nproc; + gchelperstart(); // parallel mark for over gc roots @@ -1814,7 +1816,8 @@ runtime·gchelper(void) runtime·parfordo(work.sweepfor); bufferList[m->helpgc].busy = 0; - if(runtime·xadd(&work.ndone, +1) == work.nproc-1) + nproc = work.nproc; // work.nproc can change right after we increment work.ndone + if(runtime·xadd(&work.ndone, +1) == nproc-1) runtime·notewakeup(&work.alldone); } |