Documentation
¶
Overview ¶
Package fakeclock 是测试专用的假时钟:时间只在调 Advance 时前进, 测试不真 sleep,时序完全确定(宪法第 V 条)。
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Clock ¶
type Clock struct {
// contains filtered or unexported fields
}
Clock 实现 taskgate.Clock。并发安全,所有等待者靠 Advance 手动唤醒。
func (*Clock) TickerCount ¶
TickerCount 当前注册的 ticker 数(含已 Stop 未清理的)。给测试做同步用: 被测代码的 ticker 常由后台 goroutine 异步创建,先等它挂上再 Advance, 否则拨钟发生在注册之前,那一格滴答就永远丢了(假时钟只在 Advance 时发滴答)。
Click to show internal directories.
Click to hide internal directories.