Skip to content

Commit b914054

Browse files
miss-islingtonslatenyhauntsaninja
authored
gh-77771: Add enterabs example in sched (GH-92716)
(cherry picked from commit 0f64206) Co-authored-by: Stanley <46876382+slateny@users.noreply.github.com> Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
1 parent c4aff6d commit b914054

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

Doc/library/sched.rst

+11-5
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,22 @@ Example::
4444
... print(time.time())
4545
... s.enter(10, 1, print_time)
4646
... s.enter(5, 2, print_time, argument=('positional',))
47+
... # despite having higher priority, 'keyword' runs after 'positional' as enter() is relative
4748
... s.enter(5, 1, print_time, kwargs={'a': 'keyword'})
49+
... s.enterabs(1_650_000_000, 10, print_time, argument=("first enterabs",))
50+
... s.enterabs(1_650_000_000, 5, print_time, argument=("second enterabs",))
4851
... s.run()
4952
... print(time.time())
5053
...
5154
>>> print_some_times()
52-
930343690.257
53-
From print_time 930343695.274 positional
54-
From print_time 930343695.275 keyword
55-
From print_time 930343700.273 default
56-
930343700.276
55+
1652342830.3640375
56+
From print_time 1652342830.3642538 second enterabs
57+
From print_time 1652342830.3643398 first enterabs
58+
From print_time 1652342835.3694863 positional
59+
From print_time 1652342835.3696074 keyword
60+
From print_time 1652342840.369612 default
61+
1652342840.3697174
62+
5763

5864
.. _scheduler-objects:
5965

0 commit comments

Comments
 (0)