@@ -14,7 +14,6 @@ class EventLoop:
14
14
15
15
def __init__ (self ):
16
16
self .q = []
17
- self .cnt = 0
18
17
19
18
def time (self ):
20
19
return time .ticks_ms ()
@@ -34,12 +33,9 @@ def call_later_ms(self, delay, callback, *args):
34
33
self .call_at (time .ticks_add (self .time (), delay ), callback , * args )
35
34
36
35
def call_at (self , time , callback , * args ):
37
- # Including self.cnt is a workaround per heapq docs
38
36
if __debug__ :
39
- log .debug ("Scheduling %s" , (time , self .cnt , callback , args ))
40
- heapq .heappush (self .q , (time , self .cnt , callback , args ), True )
41
- # print(self.q)
42
- self .cnt += 1
37
+ log .debug ("Scheduling %s" , (time , callback , args ))
38
+ heapq .heappush (self .q , (time , callback , args ), True )
43
39
44
40
def wait (self , delay ):
45
41
# Default wait implementation, to be overriden in subclasses
@@ -51,9 +47,9 @@ def wait(self, delay):
51
47
def run_forever (self ):
52
48
while True :
53
49
if self .q :
54
- t , cnt , cb , args = heapq .heappop (self .q , True )
50
+ t , cb , args = heapq .heappop (self .q , True )
55
51
if __debug__ :
56
- log .debug ("Next coroutine to run: %s" , (t , cnt , cb , args ))
52
+ log .debug ("Next coroutine to run: %s" , (t , cb , args ))
57
53
# __main__.mem_info()
58
54
tnow = self .time ()
59
55
delay = time .ticks_diff (t , tnow )
0 commit comments