summaryrefslogtreecommitdiff
path: root/libgo/go/time/sys_unix.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/time/sys_unix.go')
-rw-r--r--libgo/go/time/sys_unix.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/libgo/go/time/sys_unix.go b/libgo/go/time/sys_unix.go
new file mode 100644
index 00000000000..0119bdf7bf9
--- /dev/null
+++ b/libgo/go/time/sys_unix.go
@@ -0,0 +1,25 @@
+// Copyright 2011 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build darwin freebsd linux openbsd
+
+package time
+
+import (
+ "os"
+ "syscall"
+)
+
+func sysSleep(t int64) os.Error {
+ errno := syscall.Sleep(t)
+ if errno != 0 && errno != syscall.EINTR {
+ return os.NewSyscallError("sleep", errno)
+ }
+ return nil
+}
+
+// for testing: whatever interrupts a sleep
+func interrupt() {
+ syscall.Kill(os.Getpid(), syscall.SIGCHLD)
+}