diff options
author | Ian Lance Taylor <iant@golang.org> | 2019-03-13 18:56:37 -0700 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2019-03-15 03:37:49 +0000 |
commit | 0a7bc8f430e3e4017910780a898a5f20d337895b (patch) | |
tree | 05de8f86002d9e9313331d1c917fe88925625b81 /src/runtime/os_netbsd.go | |
parent | 829c140f149dba8933dea0cead3a78de4c83b529 (diff) | |
download | go-git-0a7bc8f430e3e4017910780a898a5f20d337895b.tar.gz |
runtime: introduce and consistently use setNsec for timespec
The general code for setting a timespec value sometimes used set_nsec
and sometimes used a combination of set_sec and set_nsec. Standardize
on a setNsec function that takes a number of nanoseconds and splits
them up to set the tv_sec and tv_nsec fields. Consistently mark
setNsec as go:nosplit, since it has to be that way on some systems
including Darwin and GNU/Linux. Consistently use timediv on 32-bit
systems to help stay within split-stack limits on processors that
don't have a 64-bit division instruction.
Change-Id: I6396bb7ddbef171a96876bdeaf7a1c585a6d725b
Reviewed-on: https://go-review.googlesource.com/c/go/+/167389
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/runtime/os_netbsd.go')
-rw-r--r-- | src/runtime/os_netbsd.go | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/runtime/os_netbsd.go b/src/runtime/os_netbsd.go index 7deab3ed03..fa3c9fa649 100644 --- a/src/runtime/os_netbsd.go +++ b/src/runtime/os_netbsd.go @@ -148,9 +148,7 @@ func semasleep(ns int64) int32 { if wait <= 0 { return -1 } - var nsec int32 - ts.set_sec(timediv(wait, 1000000000, &nsec)) - ts.set_nsec(nsec) + ts.setNsec(wait) tsp = &ts } ret := lwp_park(_CLOCK_MONOTONIC, _TIMER_RELTIME, tsp, 0, unsafe.Pointer(&_g_.m.waitsemacount), nil) |