Reviewers: golang-dev_googlegroups.com,
Message:
Hello [email protected],
I'd like you to review this change to
https://dvyukov%[email protected]/p/go/
Description:
runtime/race: more precise handling of finalizers
Currently race detector runtime just disables race detection in the
finalizer goroutine.
It has false positives when a finalizer writes to shared memory -- the
race with finalizer is reported in a normal goroutine that accesses the
same memory.
After this change I am going to synchronize the finalizer goroutine with
the rest of the world in racefingo(). This is closer to what happens in
reality and so
does not have false positives.
Please review this at http://codereview.appspot.com/6810095/
Affected files:
M src/pkg/runtime/mgc0.c
Index: src/pkg/runtime/mgc0.c
===================================================================
--- a/src/pkg/runtime/mgc0.c
+++ b/src/pkg/runtime/mgc0.c
@@ -1137,9 +1137,6 @@
byte *frame;
uint32 framesz, framecap, i;
- if(raceenabled)
- runtime·racefingo();
-
frame = nil;
framecap = 0;
for(;;) {
@@ -1156,6 +1153,8 @@
runtime·park(nil, nil, "finalizer wait");
continue;
}
+ if(raceenabled)
+ runtime·racefingo();
for(; fb; fb=next) {
next = fb->next;
for(i=0; i<fb->cnt; i++) {