mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
undo CL 7310096 / 59da6744d66d
broke windows build ««« original CL description runtime: ensure forward progress of runtime.Gosched() for locked goroutines The removed code leads to the situation when M executes the same locked G again and again. Fixes #4820. R=golang-dev, rsc CC=golang-dev https://golang.org/cl/7310096 »»» TBR=dvyukov CC=golang-dev https://golang.org/cl/7343050
This commit is contained in:
parent
c92d3552e5
commit
60526ca6d1
2 changed files with 8 additions and 30 deletions
|
|
@ -46,36 +46,6 @@ func TestStopTheWorldDeadlock(t *testing.T) {
|
|||
runtime.GOMAXPROCS(maxprocs)
|
||||
}
|
||||
|
||||
func TestYieldProgress(t *testing.T) {
|
||||
testYieldProgress(t, false)
|
||||
}
|
||||
|
||||
func TestYieldLockedProgress(t *testing.T) {
|
||||
testYieldProgress(t, true)
|
||||
}
|
||||
|
||||
func testYieldProgress(t *testing.T, locked bool) {
|
||||
c := make(chan bool)
|
||||
cack := make(chan bool)
|
||||
go func() {
|
||||
if locked {
|
||||
runtime.LockOSThread()
|
||||
}
|
||||
for {
|
||||
select {
|
||||
case <-c:
|
||||
cack <- true
|
||||
break
|
||||
default:
|
||||
runtime.Gosched()
|
||||
}
|
||||
}
|
||||
}()
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
c <- true
|
||||
<-cack
|
||||
}
|
||||
|
||||
func TestYieldLocked(t *testing.T) {
|
||||
const N = 10
|
||||
c := make(chan bool)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue