]> Cypherpunks repositories - gostls13.git/commit
runtime: convert forcegc helper to Go
authorDmitriy Vyukov <dvyukov@google.com>
Fri, 29 Aug 2014 07:08:10 +0000 (11:08 +0400)
committerDmitriy Vyukov <dvyukov@google.com>
Fri, 29 Aug 2014 07:08:10 +0000 (11:08 +0400)
commit42486ffc5d435e01ca9491b64d3a52d39de169d7
treeac32833280ed781ec93442594b7e7a13154fcc02
parentef64d9ffcc237fde9bcaed1fd00c5036c4f489de
runtime: convert forcegc helper to Go
Also fix a bunch of bugs:
1. Accesses to last_gc must be atomic (it's int64).
2. last_gc still can be 0 during first checks in sysmon, check for 0.
3. forcegc.g can be unitialized when sysmon accesses it:
        forcegc.g is initialized by main goroutine (forcegc.g = newproc1(...)),
        and main goroutine is unsynchronized with both sysmon and forcegc goroutine.
        Initialize forcegc.g in the forcegc goroutine itself instead.

LGTM=khr
R=golang-codereviews, khr
CC=golang-codereviews, rsc
https://golang.org/cl/136770043
src/pkg/runtime/mgc0.c
src/pkg/runtime/proc.c
src/pkg/runtime/proc.go
src/pkg/runtime/runtime.h