runtime: make test for freezetheworld more precise · golang/go@7c37249 (original) (raw)

`@@ -208,6 +208,10 @@ func helpgc(nproc int32) {

`

208

208

`unlock(&sched.lock)

`

209

209

`}

`

210

210

``

``

211

`+

// freezeStopWait is a large value that freezetheworld sets

`

``

212

`+

// sched.stopwait to in order to request that all Gs permanently stop.

`

``

213

`+

const freezeStopWait = 0x7fffffff

`

``

214

+

211

215

`// Similar to stoptheworld but best-effort and can be called several times.

`

212

216

`// There is no reverse operation, used during crashing.

`

213

217

`// This function must not lock any mutexes.

`

`@@ -220,7 +224,7 @@ func freezetheworld() {

`

220

224

`// so try several times

`

221

225

`for i := 0; i < 5; i++ {

`

222

226

`// this should tell the scheduler to not start any new goroutines

`

223

``

`-

sched.stopwait = 0x7fffffff

`

``

227

`+

sched.stopwait = freezeStopWait

`

224

228

`atomicstore(&sched.gcwaiting, 1)

`

225

229

`// this should stop running goroutines

`

226

230

`if !preemptall() {

`

`@@ -1864,7 +1868,7 @@ func exitsyscallfast() bool {

`

1864

1868

`g := getg()

`

1865

1869

``

1866

1870

`// Freezetheworld sets stopwait but does not retake P's.

`

1867

``

`-

if sched.stopwait != 0 {

`

``

1871

`+

if sched.stopwait == freezeStopWait {

`

1868

1872

`g.m.mcache = nil

`

1869

1873

`g.m.p = nil

`

1870

1874

`return false

`