class documentation
class SleepDriver: (source)
Instantiate a SleepDriver
with no arguments to get one that sleeps using time.sleep
and gets the current time with time.time
.
For testing, you can supply those parameters, but for most test cases, you should probably prefer a fritter.drivers.memory.MemoryDriver
.
Method | block |
While any active timer is scheduled with reschedule , sleep until the desired time specified by that call, call the work that was scheduled, and repeat. |
Method | now |
Implementation of TimeDriver.now |
Method | reschedule |
Implementation of TimeDriver.reschedule |
Method | unschedule |
Implementation of TimeDriver.unschedule |
Instance Variable | sleep |
The time.sleep -like callable that this driver will use to sleep for a given number of seconds. |
Instance Variable | time |
The time.time -like callable that this driver will use to get the current time. |
Instance Variable | _work |
Undocumented |
While any active timer is scheduled with reschedule
, sleep until the desired time specified by that call, call the work that was scheduled, and repeat.
Parameters | |
timeout:float | if specified, the maximum, total number of seconds to sleep before unblocking, even if work remains to be done. |
Returns | |
int | Undocumented |
Note | |
When this driver runs out of work to do, it will return immediately, even if it has not yet slept for total seconds. An idle SleepDriver will return immediately without ever blocking. |