blob: 8e6d4b2cf85aea0570ef5bcbcc884c41143114c1 [file] [log] [blame]
// Copyright 2020 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build fuchsia
package dispatch
import "runtime"
func (d *Dispatcher) numServeLoops() int {
d.mu.RLock()
numLoops := d.mu.serveLoops
d.mu.RUnlock()
return numLoops
}
// Busy-waits until there are n serve loops running.
func (d *Dispatcher) WaitForNServeLoops(n int) {
for d.numServeLoops() != n {
runtime.Gosched()
}
}