int64 runtime·tickspersecond(void);
void runtime·blockevent(int64, int32);
extern int64 runtime·blockprofilerate;
+void runtime·addtimer(Timer*);
+bool runtime·deltimer(Timer*);
#pragma varargck argpos runtime·printf 1
#pragma varargck type "d" int32
static Timers timers;
static void addtimer(Timer*);
-static bool deltimer(Timer*);
// Package time APIs.
// Godoc uses the comments in package time, not these.
func startTimer(t *Timer) {
if(raceenabled)
runtime·racerelease(t);
- runtime·lock(&timers);
- addtimer(t);
- runtime·unlock(&timers);
+ runtime·addtimer(t);
}
// stopTimer removes t from the timer heap if it is there.
// It returns true if t was removed, false if t wasn't even there.
func stopTimer(t *Timer) (stopped bool) {
- stopped = deltimer(t);
+ stopped = runtime·deltimer(t);
}
// C runtime.
static FuncVal timerprocv = {timerproc};
+void
+runtime·addtimer(Timer *t)
+{
+ runtime·lock(&timers);
+ addtimer(t);
+ runtime·unlock(&timers);
+}
+
// Add a timer to the heap and start or kick the timer proc
// if the new timer is earlier than any of the others.
static void
// Delete timer t from the heap.
// Do not need to update the timerproc:
// if it wakes up early, no big deal.
-static bool
-deltimer(Timer *t)
+bool
+runtime·deltimer(Timer *t)
{
int32 i;