diff options
| author | Dmitriy Vyukov <dvyukov@google.com> | 2011-07-21 11:29:08 -0400 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2011-07-21 11:29:08 -0400 |
| commit | d6ed1b70ade474a901eb5deaf00e536d26a6ccd6 (patch) | |
| tree | c7ee82408a7c5af953cbf94b10ca8b9780a79a7a /src/pkg/runtime/proc.c | |
| parent | 6c46afdf413582f37ddebdb6b53923ef2a299610 (diff) | |
| download | go-d6ed1b70ade474a901eb5deaf00e536d26a6ccd6.tar.xz | |
runtime: replace centralized ncgocall counter with a distributed one
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4809042
Diffstat (limited to 'src/pkg/runtime/proc.c')
| -rw-r--r-- | src/pkg/runtime/proc.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/pkg/runtime/proc.c b/src/pkg/runtime/proc.c index 56c8f9bcf9..6416651ce5 100644 --- a/src/pkg/runtime/proc.c +++ b/src/pkg/runtime/proc.c @@ -278,7 +278,9 @@ mcommoninit(M *m) // Add to runtime·allm so garbage collector doesn't free m // when it is just in a register or thread-local storage. m->alllink = runtime·allm; - runtime·allm = m; + // runtime·Cgocalls() iterates over allm w/o schedlock, + // so we need to publish it safely. + runtime·atomicstorep(&runtime·allm, m); m->id = runtime·sched.mcount++; m->fastrand = 0x49f6428aUL + m->id; |
