go - Empty function in golang -
this question has answer here:
- function signature no function body 1 answer
was looking @ source code go source code, below snippet sleep.go (package time):
package time // sleep pauses current goroutine @ least duration d. // negative or 0 duration causes sleep return immediately. func sleep(d duration) // runtimenano returns current value of runtime clock in nanoseconds. func runtimenano() int64
how possible func sleep(d duration) doesn't have implementation? can find exact implementation of sleep function?
edit: answer can found in 2 links provided @davec. please read comments below see explanation why empty function can't replaced go after bootstrapping go (1.5)
considering sleep()
(it deschedules golang thread given amount of time), can't express in go, it's implemented kind of compiler instrinsic.
whoa, lots of downvotes here. looks sleep
in fact implemented in assembly.
Comments
Post a Comment