mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
runtime: use monotonic clock for openbsd/386 and openbsd/amd64 timers
Switch nanotime to a monotonic clock on openbsd/386 and openbsd/amd64. Also use a monotonic clock when for thrsleep, since the sleep duration is based on the value returned from nanotime. Update #6007 LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://golang.org/cl/68460044
This commit is contained in:
parent
66562b9698
commit
3734663805
3 changed files with 7 additions and 3 deletions
|
|
@ -82,7 +82,7 @@ runtime·semasleep(int64 ns)
|
|||
// NOTE: tv_nsec is int64 on amd64, so this assumes a little-endian system.
|
||||
ts.tv_nsec = 0;
|
||||
ts.tv_sec = runtime·timediv(ns, 1000000000, (int32*)&ts.tv_nsec);
|
||||
runtime·thrsleep(&m->waitsemacount, CLOCK_REALTIME, &ts, &m->waitsemalock, nil);
|
||||
runtime·thrsleep(&m->waitsemacount, CLOCK_MONOTONIC, &ts, &m->waitsemalock, nil);
|
||||
}
|
||||
// reacquire lock
|
||||
while(runtime·xchg(&m->waitsemalock, 1))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue