From 85b7419211d9d46cc7a73c3f8595f2a3e9ca15ff Mon Sep 17 00:00:00 2001 From: Joel Sing Date: Thu, 10 Nov 2011 11:42:01 -0800 Subject: [PATCH] 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 --- src/pkg/runtime/openbsd/thread.c | 1 + 1 file changed, 1 insertion(+) 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); -- 2.48.1