]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: remove now arg from timer callback
authorDmitriy Vyukov <dvyukov@google.com>
Thu, 21 Aug 2014 17:10:30 +0000 (21:10 +0400)
committerDmitriy Vyukov <dvyukov@google.com>
Thu, 21 Aug 2014 17:10:30 +0000 (21:10 +0400)
Cleanup before converting to Go.
Fortunately nobody using it, because it is incorrect:
monotonic runtime time instead of claimed real time.

LGTM=khr
R=golang-codereviews, khr
CC=golang-codereviews, rsc
https://golang.org/cl/129480043

src/pkg/runtime/netpoll.goc
src/pkg/runtime/time.goc
src/pkg/time/internal_test.go
src/pkg/time/sleep.go

index bbb3d06e9ad8525bd0d2407d038278131e759430..e8ae84f127365de06b8adaa7eb0cb84657c7a1dc 100644 (file)
@@ -74,9 +74,9 @@ static struct
 
 static bool    netpollblock(PollDesc*, int32, bool);
 static G*      netpollunblock(PollDesc*, int32, bool);
-static void    deadline(int64, Eface);
-static void    readDeadline(int64, Eface);
-static void    writeDeadline(int64, Eface);
+static void    deadline(Eface);
+static void    readDeadline(Eface);
+static void    writeDeadline(Eface);
 static PollDesc*       allocPollDesc(void);
 static intgo   checkerr(PollDesc *pd, int32 mode);
 
@@ -384,13 +384,12 @@ netpollunblock(PollDesc *pd, int32 mode, bool ioready)
 }
 
 static void
-deadlineimpl(int64 now, Eface arg, bool read, bool write)
+deadlineimpl(Eface arg, bool read, bool write)
 {
        PollDesc *pd;
        uint32 seq;
        G *rg, *wg;
 
-       USED(now);
        pd = (PollDesc*)arg.data;
        // This is the seq when the timer was set.
        // If it's stale, ignore the timer event.
@@ -424,21 +423,21 @@ deadlineimpl(int64 now, Eface arg, bool read, bool write)
 }
 
 static void
-deadline(int64 now, Eface arg)
+deadline(Eface arg)
 {
-       deadlineimpl(now, arg, true, true);
+       deadlineimpl(arg, true, true);
 }
 
 static void
-readDeadline(int64 now, Eface arg)
+readDeadline(Eface arg)
 {
-       deadlineimpl(now, arg, true, false);
+       deadlineimpl(arg, true, false);
 }
 
 static void
-writeDeadline(int64 now, Eface arg)
+writeDeadline(Eface arg)
 {
-       deadlineimpl(now, arg, false, true);
+       deadlineimpl(arg, false, true);
 }
 
 static PollDesc*
index f9126bd76acf09dcf409f5b9c5a73e2765f0746d..1d6346233c6dc0b232452cee89e2137a6931f0da 100644 (file)
@@ -70,10 +70,8 @@ static void siftdown(int32);
 
 // Ready the goroutine e.data.
 static void
-ready(int64 now, Eface e)
+ready(Eface e)
 {
-       USED(now);
-
        runtime·ready(e.data);
 }
 
@@ -201,7 +199,7 @@ timerproc(void)
 {
        int64 delta, now;
        Timer *t;
-       void (*f)(int64, Eface);
+       void (*f)(Eface);
        Eface arg;
 
        for(;;) {
@@ -233,7 +231,7 @@ timerproc(void)
                        runtime·unlock(&timers.lock);
                        if(raceenabled)
                                runtime·raceacquire(t);
-                       f(now, arg);
+                       f(arg);
 
                        // clear f and arg to avoid leak while sleeping for next timer
                        f = nil;
index f09d30507fcadb170ad6f6ecfc860bee4387c7d8..b02292ea163be75bef8a76741eb844d6e524230a 100644 (file)
@@ -12,7 +12,7 @@ func init() {
 var Interrupt = interrupt
 var DaysIn = daysIn
 
-func empty(now int64, arg interface{}) {}
+func empty(arg interface{}) {}
 
 // Test that a runtimeTimer with a duration so large it overflows
 // does not cause other timers to hang.
index 6a03f417bd00ffb7efe2dd224c6d1fe9bff95d1d..0fd7c9328e313a755a5f8c4d739868dce2c80ef5 100644 (file)
@@ -17,7 +17,7 @@ type runtimeTimer struct {
        i      int32
        when   int64
        period int64
-       f      func(int64, interface{}) // NOTE: must not be closure
+       f      func(interface{}) // NOTE: must not be closure
        arg    interface{}
 }
 
@@ -83,7 +83,7 @@ func (t *Timer) Reset(d Duration) bool {
        return active
 }
 
-func sendTime(now int64, c interface{}) {
+func sendTime(c interface{}) {
        // Non-blocking send of time on c.
        // Used in NewTimer, it cannot block anyway (buffer).
        // Used in NewTicker, dropping sends on the floor is
@@ -117,6 +117,6 @@ func AfterFunc(d Duration, f func()) *Timer {
        return t
 }
 
-func goFunc(now int64, arg interface{}) {
+func goFunc(arg interface{}) {
        go arg.(func())()
 }