On Tue, Feb 23, 2021 at 5:16 AM xie cui <cuiwei...@gmail.com> wrote: > > https://github.com/golang/go/blob/master/src/runtime/proc.go#L2441 > why not change to if !atomic.Cas(&sched.nmspinning, 0, 1), it seems check > sched.nmspinning no zero is unneccessary in logic, > i am not sure, i guess it's about performence issue?
An atomic load is faster than an atomic compare-and-swap. In particular, on amd64, an atomic load is just an ordinary load instruction. Ian -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAOyqgcW%3DYY7M5p-cZ8VHPA2a5-LhWktyHeFzH31XMo3sPpz17Q%40mail.gmail.com.