Implement runtime.Sleep

This commit is contained in:
Ayke van Laethem
2018-04-22 19:23:16 +02:00
parent cefce41df0
commit ea129f3072
+20
View File
@@ -0,0 +1,20 @@
package runtime
// TODO: use the time package for this.
// #include <unistd.h>
import "C"
type Duration uint64
// Use microseconds as the smallest time unit
const (
Microsecond = 1
Millisecond = Microsecond * 1000
Second = Millisecond * 1000
)
func Sleep(d Duration) {
C.usleep(C.useconds_t(d))
}