mirror of
https://github.com/golang/go
synced 2024-11-24 02:40:17 -07:00
runtime: fix data race in GC
Fixes #5139. Update #7065. R=golang-codereviews, bradfitz, minux.ma CC=golang-codereviews https://golang.org/cl/52090045
This commit is contained in:
parent
89c9d6b7f8
commit
b3a3afc9b7
@ -1956,6 +1956,8 @@ runtime·memorydump(void)
|
|||||||
void
|
void
|
||||||
runtime·gchelper(void)
|
runtime·gchelper(void)
|
||||||
{
|
{
|
||||||
|
int32 nproc;
|
||||||
|
|
||||||
gchelperstart();
|
gchelperstart();
|
||||||
|
|
||||||
// parallel mark for over gc roots
|
// parallel mark for over gc roots
|
||||||
@ -1972,7 +1974,8 @@ runtime·gchelper(void)
|
|||||||
|
|
||||||
runtime·parfordo(work.sweepfor);
|
runtime·parfordo(work.sweepfor);
|
||||||
bufferList[m->helpgc].busy = 0;
|
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);
|
runtime·notewakeup(&work.alldone);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user