From: Joel Sing Date: Thu, 10 Nov 2011 19:42:01 +0000 (-0800) Subject: runtime: fix semasleep() duration for openbsd X-Git-Tag: weekly.2011-11-18~119 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=85b7419211d9d46cc7a73c3f8595f2a3e9ca15ff;p=gostls13.git runtime: fix semasleep() duration for openbsd The timespec passed to thrsleep() needs to be an absolute/realtime value, so add the current nanotime to ns. R=golang-dev, rsc CC=golang-dev https://golang.org/cl/5374048 --- diff --git a/src/pkg/runtime/openbsd/thread.c b/src/pkg/runtime/openbsd/thread.c index fd8cbfd033..995a46edd6 100644 --- a/src/pkg/runtime/openbsd/thread.c +++ b/src/pkg/runtime/openbsd/thread.c @@ -79,6 +79,7 @@ runtime·semasleep(int64 ns) if(ns < 0) runtime·thrsleep(&m->waitsemacount, 0, nil, &m->waitsemalock); else { + ns += runtime·nanotime(); ts.tv_sec = ns/1000000000LL; ts.tv_nsec = ns%1000000000LL; runtime·thrsleep(&m->waitsemacount, CLOCK_REALTIME, &ts, &m->waitsemalock);