Commit f6d0054e authored by Russ Cox's avatar Russ Cox
Browse files

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: default avatarAustin Clements <austin@google.com>
parent 882f21d6
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment