runtime: serialize mcache allocation

Fixes racy regex-dna-parallel crashes.

R=r, r2
CC=golang-dev
https://golang.org/cl/2308042
This commit is contained in:
Russ Cox 2010-09-30 14:09:19 -04:00
parent f6a217827a
commit 7389ab8d21

View File

@ -236,9 +236,11 @@ allocmcache(void)
{
MCache *c;
lock(&mheap);
c = FixAlloc_Alloc(&mheap.cachealloc);
mstats.mcache_inuse = mheap.cachealloc.inuse;
mstats.mcache_sys = mheap.cachealloc.sys;
unlock(&mheap);
return c;
}