Commit 495b9143 authored by Russ Cox's avatar Russ Cox

[release-branch.go1.2] runtime: fix data race in GC

««« CL 52090045 / 302bdb5b08b1
runtime: fix data race in GC
Fixes #5139.
Update #7065.

R=golang-codereviews, bradfitz, minux.ma
CC=golang-codereviews
https://golang.org/cl/52090045
»»»

LGTM=r
R=golang-codereviews, r
CC=golang-dev
https://golang.org/cl/69790043
parent 950555c8
......@@ -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);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment