Commit 4aaddf8a authored by Joe Poirier's avatar Joe Poirier Committed by Russ Cox

syscall: mingw Sleep

R=rsc, brainman
CC=golang-dev
https://golang.org/cl/961047
parent 77817e08
......@@ -121,9 +121,18 @@ func getSysProcAddr(m uint32, pname string) uintptr {
//sys GetComputerName(buf *uint16, n *uint32) (ok bool, errno int) = GetComputerNameW
//sys SetEndOfFile(handle int32) (ok bool, errno int)
//sys GetSystemTimeAsFileTime(time *Filetime)
//sys sleep(msec uint32) = Sleep
// syscall interface implementation for other packages
func Sleep(nsec int64) (errno int) {
nsec += 999999 // round up to milliseconds
msec := uint32(nsec / 1e6)
sleep(msec)
errno = 0
return
}
func Errstr(errno int) string {
if errno == EMINGW {
return "not supported by windows"
......
// mksyscall_mingw.sh -l32 syscall_mingw.go syscall_mingw_386.go
// mksyscall_mingw.sh -l32 syscall_mingw.go zsyscall_mingw_386.go
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
package syscall
......@@ -33,6 +33,7 @@ var (
procGetComputerNameW = getSysProcAddr(modKERNEL32, "GetComputerNameW")
procSetEndOfFile = getSysProcAddr(modKERNEL32, "SetEndOfFile")
procGetSystemTimeAsFileTime = getSysProcAddr(modKERNEL32, "GetSystemTimeAsFileTime")
procSleep = getSysProcAddr(modKERNEL32, "Sleep")
)
func GetLastError() (lasterrno int) {
......@@ -315,3 +316,8 @@ func GetSystemTimeAsFileTime(time *Filetime) {
Syscall(procGetSystemTimeAsFileTime, uintptr(unsafe.Pointer(time)), 0, 0)
return
}
func sleep(msec uint32) {
Syscall(procSleep, uintptr(msec), 0, 0)
return
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment