diff options
| author | Michael Stapelberg <michael@stapelberg.de> | 2013-03-23 11:28:53 +0100 |
|---|---|---|
| committer | Michael Stapelberg <michael@stapelberg.de> | 2013-03-23 11:28:53 +0100 |
| commit | b39e15dde5ec7b96c15da9faf4ab5892501c1aae (patch) | |
| tree | 718cede1f6ca97d082c6c40b7dc3f4f6148253c0 /src/pkg/runtime/time.goc | |
| parent | 04b08da9af0c450d645ab7389d1467308cfc2db8 (diff) | |
| download | golang-upstream/1.1_hg20130323.tar.gz | |
Imported Upstream version 1.1~hg20130323upstream/1.1_hg20130323
Diffstat (limited to 'src/pkg/runtime/time.goc')
| -rw-r--r-- | src/pkg/runtime/time.goc | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/pkg/runtime/time.goc b/src/pkg/runtime/time.goc index 2babb173d..6de989f51 100644 --- a/src/pkg/runtime/time.goc +++ b/src/pkg/runtime/time.goc @@ -15,7 +15,6 @@ package time static Timers timers; static void addtimer(Timer*); -static bool deltimer(Timer*); // Package time APIs. // Godoc uses the comments in package time, not these. @@ -31,15 +30,13 @@ func Sleep(ns int64) { 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. @@ -79,6 +76,14 @@ runtime·tsleep(int64 ns, int8 *reason) 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 @@ -121,8 +126,8 @@ addtimer(Timer *t) // 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; |
