Last active
August 28, 2018 08:38
-
-
Save woodRock/b67d2114e36ca87efc00d124c8f8af92 to your computer and use it in GitHub Desktop.
Implement a job scheduler which takes in a function f and an integer n, and * calls f after n milliseconds.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sched, time | |
s = sched.scheduler(time.time, time.sleep) | |
def print_time(): print ("From print_time", time.time()) | |
def job_scheduler(f,n): | |
s.enter(n, 1, f, ()) | |
s.run() | |
job_scheduler(print_time, 10) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment