I was wondering how time.Sleep() is implemented in the standard library. There is no implementation?! https://golang.org/src/time/sleep.go#L9 - its just the function definition without the function body. What am I missing?
time.Sleep() is actually implemented in the runtime. You can find the implementation here: https://github.com/golang/go/blob/master/src/runtime/time.go#L47. You see can that it is linking the time.Sleep() call to the timeSleep() func with the //go:linkname
directive.
4 Likes
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.