Ejemplo n.º 1
0
func getWaiterChannel(waiter gate.Waiter) <-chan struct{} {
	// If a gate is unlocked, don't select on it.
	if waiter.IsUnlocked() {
		return nil
	}
	return waiter.Unlocked()
}
Ejemplo n.º 2
0
func assertUnlocked(c *gc.C, waiter gate.Waiter) {
	c.Assert(waiter.IsUnlocked(), jc.IsTrue)
	select {
	case <-waiter.Unlocked():
	default:
		c.Fatalf("expected gate to be unlocked")
	}
}
Ejemplo n.º 3
0
func assertLocked(c *gc.C, waiter gate.Waiter) {
	c.Assert(waiter.IsUnlocked(), jc.IsFalse)
	select {
	case <-waiter.Unlocked():
		c.Fatalf("expected gate to be locked")
	default:
	}
}