The example in the documentation is a little misleading as it tries to show 2 different aspects of the scheduler (priority vs positional/kwargs)
with the same code lines:
It has the following:
s.enter(5, 2, print_time, argument=(‘positional’,))
s.enter(5, 1, print_time, kwargs={‘a’: ‘keyword’})
but in fact, the line with priority 2 will actually run before the line with priorty 1 as the actual time to run for each of them is different.
I think the following (code inside print_some_times method) would be better:
…
tt = time.time()
print(tt)
s.enter(10, 1, print_time)
s.enterabs((tt+5), 2, print_time, argument=(‘positional’,))
s.enterabs((tt+5), 1, print_time, kwargs={‘a’: ‘keyword’})
…
____________________________
Jay Goldman
Subcontractor
MIT Lincoln Laboratory
Cyber-Physical Systems
244 Wood Street
Lexington, MA 02420
Phone (Office): 781-981-0649
Email: jay.goldman(a)ll.mit.edu<mailto:jay.goldman@ll.mit.edu>