• Russ Cox's avatar
    runtime: avoid race checking for preemption · f6d0054e
    Russ Cox authored
    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/2823Reviewed-by: default avatarAustin Clements <austin@google.com>
    f6d0054e
stack1.go 23.9 KB