// 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() | |
} | |
} |