]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: fix nmspinning comparison
authorTodd Neal <todd@tneal.org>
Tue, 25 Aug 2015 00:11:35 +0000 (19:11 -0500)
committerTodd Neal <todd@tneal.org>
Tue, 25 Aug 2015 02:44:11 +0000 (02:44 +0000)
nmspinning has a value range of [0, 2^31-1].  Update the comment to
indicate this and fix the comparison so it's not always false.

Fixes #11280

Change-Id: Iedaf0654dcba5e2c800645f26b26a1a781ea1991
Reviewed-on: https://go-review.googlesource.com/13877
Reviewed-by: Minux Ma <minux@golang.org>
src/runtime/proc1.go
src/runtime/runtime2.go

index 09cb775f0dee9b49c5164b039506462a6119567c..a5708162de6bfdefe7e8f84c2d767bc38fc678df 100644 (file)
@@ -1538,7 +1538,7 @@ func resetspinning() {
        if _g_.m.spinning {
                _g_.m.spinning = false
                nmspinning = xadd(&sched.nmspinning, -1)
-               if nmspinning < 0 {
+               if int32(nmspinning) < 0 {
                        throw("findrunnable: negative nmspinning")
                }
        } else {
index 57cd869d88c0c795b9bcde49165c5d487a1ef721..fbd43d21da628a5207cedf8bc085c1ea55f8a1dd 100644 (file)
@@ -429,7 +429,7 @@ type schedt struct {
 
        pidle      puintptr // idle p's
        npidle     uint32
-       nmspinning uint32
+       nmspinning uint32 // limited to [0, 2^31-1]
 
        // Global runnable queue.
        runqhead guintptr