diff options
| author | Dmitriy Vyukov <dvyukov@google.com> | 2013-07-17 12:52:37 -0400 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2013-07-17 12:52:37 -0400 |
| commit | 5887f142a33fbb8da94088e902ced4101a16aa8f (patch) | |
| tree | 34e4b531885ee16e020a5fc0289a4836f561f7ed /src/pkg/runtime/lock_futex.c | |
| parent | a83748596c009db47bcd35a69531e485e2c7f924 (diff) | |
| download | go-5887f142a33fbb8da94088e902ced4101a16aa8f.tar.xz | |
runtime: more reliable preemption
Currently preemption signal g->stackguard0==StackPreempt
can be lost if it is received when preemption is disabled
(e.g. m->lock!=0). This change duplicates the preemption
signal in g->preempt and restores g->stackguard0
when preemption is enabled.
Update #543.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/10792043
Diffstat (limited to 'src/pkg/runtime/lock_futex.c')
| -rw-r--r-- | src/pkg/runtime/lock_futex.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/pkg/runtime/lock_futex.c b/src/pkg/runtime/lock_futex.c index 5309a21a13..95d590bae9 100644 --- a/src/pkg/runtime/lock_futex.c +++ b/src/pkg/runtime/lock_futex.c @@ -5,6 +5,7 @@ // +build freebsd linux #include "runtime.h" +#include "stack.h" // This implementation depends on OS-specific implementations of // @@ -99,6 +100,8 @@ runtime·unlock(Lock *l) if(--m->locks < 0) runtime·throw("runtime·unlock: lock count"); + if(m->locks == 0 && g->preempt) // restore the preemption request in case we've cleared it in newstack + g->stackguard0 = StackPreempt; } // One-time notifications. |
