aboutsummaryrefslogtreecommitdiff
path: root/libgo/runtime/runtime.h
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2016-10-15 00:29:06 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2016-10-15 00:29:06 +0000
commit35d942444418606e75f2e65aa7708616c5233035 (patch)
tree156c9d476a537c240533dedcf79341b37bcdf5d9 /libgo/runtime/runtime.h
parent2a0b23da0560f4d321e28ae3673cd130ebf0e8f8 (diff)
downloadgcc-35d942444418606e75f2e65aa7708616c5233035.zip
gcc-35d942444418606e75f2e65aa7708616c5233035.tar.gz
gcc-35d942444418606e75f2e65aa7708616c5233035.tar.bz2
runtime: copy runtime package time code from Go 1.7
Fix handling of function values for -fgo-c-header to generate FuncVal*, not simply FuncVal. While we're here change runtime.nanotime to use clock_gettime with CLOCK_MONOTONIC, rather than gettimeofday. This is what the gc library does. It provides nanosecond precision and a monotonic clock. Reviewed-on: https://go-review.googlesource.com/31232 From-SVN: r241197
Diffstat (limited to 'libgo/runtime/runtime.h')
-rw-r--r--libgo/runtime/runtime.h42
1 files changed, 7 insertions, 35 deletions
diff --git a/libgo/runtime/runtime.h b/libgo/runtime/runtime.h
index be19e95..f73d745 100644
--- a/libgo/runtime/runtime.h
+++ b/libgo/runtime/runtime.h
@@ -66,8 +66,7 @@ typedef struct SigTab SigTab;
typedef struct mcache MCache;
typedef struct FixAlloc FixAlloc;
typedef struct hchan Hchan;
-typedef struct Timers Timers;
-typedef struct Timer Timer;
+typedef struct timer Timer;
typedef struct gcstats GCStats;
typedef struct LFNode LFNode;
typedef struct ParFor ParFor;
@@ -181,36 +180,6 @@ enum {
};
#endif
-struct Timers
-{
- Lock;
- G *timerproc;
- bool sleeping;
- bool rescheduling;
- Note waitnote;
- Timer **t;
- int32 len;
- int32 cap;
-};
-
-// Package time knows the layout of this structure.
-// If this struct changes, adjust ../time/sleep.go:/runtimeTimer.
-// For GOOS=nacl, package syscall knows the layout of this structure.
-// If this struct changes, adjust ../syscall/net_nacl.go:/runtimeTimer.
-struct Timer
-{
- intgo i; // heap index
-
- // Timer wakes up at when, and then at when+period, ... (period > 0 only)
- // each time calling f(now, arg) in the timer goroutine, so f must be
- // a well-behaved function and not block.
- int64 when;
- int64 period;
- FuncVal *fv;
- Eface arg;
- uintptr seq;
-};
-
// Lock-free stack node.
struct LFNode
{
@@ -403,7 +372,8 @@ bool __go_sigsend(int32 sig);
int32 runtime_callers(int32, Location*, int32, bool keep_callers);
int64 runtime_nanotime(void) // monotonic time
__asm__(GOSYM_PREFIX "runtime.nanotime");
-int64 runtime_unixnanotime(void); // real time, can skip
+int64 runtime_unixnanotime(void) // real time, can skip
+ __asm__ (GOSYM_PREFIX "runtime.unixnanotime");
void runtime_dopanic(int32) __attribute__ ((noreturn));
void runtime_startpanic(void);
void runtime_freezetheworld(void);
@@ -422,8 +392,10 @@ int64 runtime_tickspersecond(void)
__asm__ (GOSYM_PREFIX "runtime.tickspersecond");
void runtime_blockevent(int64, int32);
extern int64 runtime_blockprofilerate;
-void runtime_addtimer(Timer*);
-bool runtime_deltimer(Timer*);
+void runtime_addtimer(Timer*)
+ __asm__ (GOSYM_PREFIX "runtime.addtimer");
+bool runtime_deltimer(Timer*)
+ __asm__ (GOSYM_PREFIX "runtime.deltimer");
G* runtime_netpoll(bool);
void runtime_netpollinit(void);
int32 runtime_netpollopen(uintptr, PollDesc*);