]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: fix semasleep() duration for openbsd
authorJoel Sing <jsing@google.com>
Thu, 10 Nov 2011 19:42:01 +0000 (11:42 -0800)
committerBrad Fitzpatrick <bradfitz@golang.org>
Thu, 10 Nov 2011 19:42:01 +0000 (11:42 -0800)
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

index fd8cbfd033f787476f2c3cb6e404bd66f84920a5..995a46edd66efa8ffc58f4634995837b018edfc0 100644 (file)
@@ -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);