]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: fix prototype for openbsd thrsleep
authorJoel Sing <jsing@google.com>
Mon, 7 Nov 2011 16:57:34 +0000 (11:57 -0500)
committerRuss Cox <rsc@golang.org>
Mon, 7 Nov 2011 16:57:34 +0000 (11:57 -0500)
- Fix function prototype for thrsleep().
- Provide enums for clock identifiers.
- Provide timespec structure for use with thrsleep().

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/5360042

src/pkg/runtime/openbsd/386/defs.h
src/pkg/runtime/openbsd/amd64/defs.h
src/pkg/runtime/openbsd/defs.c
src/pkg/runtime/openbsd/thread.c

index d61462c6f9a94f1c1d71baf3e939bb996fb3736d..aff87fb3b1f46a4cf690fb1798a47df63af25e87 100644 (file)
@@ -97,6 +97,12 @@ struct StackT {
        int32 ss_flags;
 };
 
+typedef struct Timespec Timespec;
+struct Timespec {
+       int32 tv_sec;
+       int32 tv_nsec;
+};
+
 typedef struct Timeval Timeval;
 struct Timeval {
        int32 tv_sec;
index 968f22d586066caa31754a15819f5d5c758cdb7e..27bf4b9d655a0740add2a7b0bf8c844a2b25e676 100644 (file)
@@ -100,6 +100,13 @@ struct StackT {
        byte pad_godefs_0[4];
 };
 
+typedef struct Timespec Timespec;
+struct Timespec {
+       int32 tv_sec;
+       byte pad_godefs_0[4];
+       int64 tv_nsec;
+};
+
 typedef struct Timeval Timeval;
 struct Timeval {
        int64 tv_sec;
index d0e0a19c357479b5f2b12a8527a198ae52117c72..9806c80b695cf23943c0ee4499a073634970af16 100644 (file)
@@ -93,6 +93,7 @@ typedef union sigval $Sigval;
 
 typedef stack_t $StackT;
 
+typedef struct timespec $Timespec;
 typedef struct timeval $Timeval;
 typedef struct itimerval $Itimerval;
 
index e6419bf86a707f84d4ec1c2ca4b0f5b5906997cd..e16bc47627d8b35ab60d0feb283fcc9bb2e39dec 100644 (file)
@@ -18,13 +18,19 @@ enum
 
        ESRCH = 3,
        ENOTSUP = 91,
+
+       // From OpenBSD's sys/time.h
+       CLOCK_REALTIME = 0,
+       CLOCK_VIRTUAL = 1,
+       CLOCK_PROF = 2,
+       CLOCK_MONOTONIC = 3
 };
 
 extern SigTab runtime·sigtab[];
 
 extern int64 runtime·rfork_thread(int32 flags, void *stack, M *m, G *g, void (*fn)(void));
-extern int32 runtime·thrsleep(void *, void *, void*, void *);
-extern int32 runtime·thrwakeup(void *, int32);
+extern int32 runtime·thrsleep(void *ident, int32 clock_id, void *tsp, void *lock);
+extern int32 runtime·thrwakeup(void *ident, int32 n);
 
 // From OpenBSD's <sys/sysctl.h>
 #define        CTL_HW  6
@@ -65,7 +71,7 @@ retry:
                runtime·osyield();
        if(m->waitsemacount == 0) {
                // the function unlocks the spinlock
-               runtime·thrsleep(&m->waitsemacount, 0, 0, &m->waitsemalock);
+               runtime·thrsleep(&m->waitsemacount, 0, nil, &m->waitsemalock);
                goto retry;
        }
        m->waitsemacount--;