Skip to content

Commit bf445c3

Browse files
author
Charles Weir
committed
Minor change to Scheduler
1 parent 08e4c2f commit bf445c3

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

BrickPython/Scheduler.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ class Scheduler():
2121
It supports one special coroutine - the updatorCoroutine, which is invoked before and after all the other ones.
2222
'''
2323

24+
timeMillisBetweenWorkCalls = 50
25+
2426
@staticmethod
2527
def currentTimeMillis():
2628
'Answers the time in floating point milliseconds since program start.'
@@ -29,7 +31,7 @@ def currentTimeMillis():
2931
return c.days * (3600.0 * 1000 * 24) + c.seconds * 1000.0 + c.microseconds / 1000.0
3032

3133
def __init__(self, timeMillisBetweenWorkCalls = 50):
32-
self.timeMillisBetweenWorkCalls = timeMillisBetweenWorkCalls
34+
Scheduler.timeMillisBetweenWorkCalls = timeMillisBetweenWorkCalls
3335
self.coroutines = []
3436
self.timeOfLastCall = Scheduler.currentTimeMillis()
3537
self.updateCoroutine = self.nullCoroutine() # for testing - usually replaced.
@@ -145,7 +147,7 @@ def waitMilliseconds( timeMillis ):
145147

146148
@staticmethod
147149
def withTimeout( timeoutMillis, *coroutineList ):
148-
'Coroutine that wraps the given coroutine with a timeout'
150+
'Coroutine that wraps the given coroutine(s) with a timeout'
149151
return Scheduler.runTillFirstCompletes( Scheduler.waitMilliseconds( timeoutMillis ), *coroutineList )
150152

151153
@staticmethod

0 commit comments

Comments
 (0)