]> Cypherpunks repositories - gostls13.git/commit
runtime: avoid race checking for preemption
authorRuss Cox <rsc@golang.org>
Wed, 14 Jan 2015 21:36:41 +0000 (16:36 -0500)
committerRuss Cox <rsc@golang.org>
Wed, 14 Jan 2015 22:20:33 +0000 (22:20 +0000)
commitf6d0054e718817df636a1281a2f8de04ac663ee8
tree65bb8c903f22080f82903be72f6ee42ddca5b839
parent882f21d6aef78c55265662dbac3af1d38d6f7c82
runtime: avoid race checking for preemption

Moving the "don't really preempt" check up earlier in the function
introduced a race where gp.stackguard0 might change between
the early check and the later one. Since the later one is missing the
"don't really preempt" logic, it could decide to preempt incorrectly.
Pull the result of the check into a local variable and use an atomic
to access stackguard0, to eliminate the race.

I believe this will fix the broken OS X and Solaris builders.

Change-Id: I238350dd76560282b0c15a3306549cbcf390dbff
Reviewed-on: https://go-review.googlesource.com/2823
Reviewed-by: Austin Clements <austin@google.com>
src/runtime/stack1.go