diff options
author | Stanley <46876382+slateny@users.noreply.github.com> | 2022-12-24 05:21:52 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-24 05:21:52 (GMT) |
commit | 0f6420640c0f3462e6b76b01a392844676de1fb9 (patch) | |
tree | 4015ac93655020443606bd2f62f1555d0ab22957 /Doc/library/sched.rst | |
parent | 3e46f9fe05b40ee42009878620f448d3a4b44cb5 (diff) | |
download | cpython-0f6420640c0f3462e6b76b01a392844676de1fb9.zip cpython-0f6420640c0f3462e6b76b01a392844676de1fb9.tar.gz cpython-0f6420640c0f3462e6b76b01a392844676de1fb9.tar.bz2 |
gh-77771: Add enterabs example in sched (#92716)
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Diffstat (limited to 'Doc/library/sched.rst')
-rw-r--r-- | Doc/library/sched.rst | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/Doc/library/sched.rst b/Doc/library/sched.rst index a4ba284..a051c65 100644 --- a/Doc/library/sched.rst +++ b/Doc/library/sched.rst @@ -44,16 +44,22 @@ Example:: ... print(time.time()) ... s.enter(10, 1, print_time) ... s.enter(5, 2, print_time, argument=('positional',)) + ... # despite having higher priority, 'keyword' runs after 'positional' as enter() is relative ... s.enter(5, 1, print_time, kwargs={'a': 'keyword'}) + ... s.enterabs(1_650_000_000, 10, print_time, argument=("first enterabs",)) + ... s.enterabs(1_650_000_000, 5, print_time, argument=("second enterabs",)) ... s.run() ... print(time.time()) ... >>> print_some_times() - 930343690.257 - From print_time 930343695.274 positional - From print_time 930343695.275 keyword - From print_time 930343700.273 default - 930343700.276 + 1652342830.3640375 + From print_time 1652342830.3642538 second enterabs + From print_time 1652342830.3643398 first enterabs + From print_time 1652342835.3694863 positional + From print_time 1652342835.3696074 keyword + From print_time 1652342840.369612 default + 1652342840.3697174 + .. _scheduler-objects: |