224
224
Sleep(3 * Second)
227
func TestSleepZeroDeadlock(t *testing.T) {
228
// Sleep(0) used to hang, the sequence of events was as follows.
229
// Sleep(0) sets G's status to Gwaiting, but then immediately returns leaving the status.
230
// Then the goroutine calls e.g. new and falls down into the scheduler due to pending GC.
231
// After the GC nobody wakes up the goroutine from Gwaiting status.
232
defer runtime.GOMAXPROCS(runtime.GOMAXPROCS(4))
235
for i := 0; i < 100; i++ {
240
for i := 0; i < 100; i++ {
242
tmp := make(chan bool, 1)