time.sleep函数声明在哪里



这是go core库的time包中文件sleep.go的第一行:

// Sleep pauses the current goroutine for at least the duration d.
// A negative or zero duration causes Sleep to return immediately.
func Sleep(d Duration)
// runtimeNano returns the current value of the runtime clock in nanoseconds.
func runtimeNano() int64

为什么这里没有函数time.Sleep声明?在哪里?

它在运行时/time.go。

有关go:linkname的详细信息,请参见编译器指令。

最新更新