From: Zhou Peng Date: Wed, 16 May 2018 12:56:54 +0000 (+0000) Subject: runtime: use debugSelect flag to toggle debug code X-Git-Tag: go1.11beta1~409 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=dbd66fd3d07433a03da5dc6c6def8c53951ada77;p=gostls13.git runtime: use debugSelect flag to toggle debug code This block of code once was commented by the original author, but commenting code looks a little annoying. However, the debugSelect flag is just for the situation that debug code will be compiled when debuging, when release this code will be eliminated by the compiler. Change-Id: I7b94297e368b515116ef44a36058214ddddf9adb Reviewed-on: https://go-review.googlesource.com/113395 Reviewed-by: Brad Fitzpatrick Run-TryBot: Brad Fitzpatrick TryBot-Result: Gobot Gobot --- diff --git a/src/runtime/select.go b/src/runtime/select.go index fccb53b44c..3a3ac6b7ac 100644 --- a/src/runtime/select.go +++ b/src/runtime/select.go @@ -191,14 +191,15 @@ func selectgo(cas0 *scase, order0 *uint16, ncases int) (int, bool) { } lockorder[j] = o } - /* + + if debugSelect { for i := 0; i+1 < ncases; i++ { if scases[lockorder[i]].c.sortkey() > scases[lockorder[i+1]].c.sortkey() { print("i=", i, " x=", lockorder[i], " y=", lockorder[i+1], "\n") throw("select: broken sort") } } - */ + } // lock all the channels involved in the select sellock(scases, lockorder)