mirror of
https://github.com/python/cpython.git
synced 2025-11-02 19:12:55 +00:00
bpo-21302: Add nanosleep() implementation for time.sleep() in Unix (GH-28545)
Co-authored-by: Livius <egyszeregy@freemail.hu>
This commit is contained in:
parent
71f8ff45c6
commit
7834ff26cb
7 changed files with 114 additions and 33 deletions
|
|
@ -364,16 +364,18 @@ Functions
|
|||
threads ready to run, the function returns immediately, and the thread
|
||||
continues execution.
|
||||
|
||||
Implementation:
|
||||
Unix implementation:
|
||||
|
||||
* On Unix, ``clock_nanosleep()`` is used if available (resolution: 1 ns),
|
||||
or ``select()`` is used otherwise (resolution: 1 us).
|
||||
* On Windows, a waitable timer is used (resolution: 100 ns). If *secs* is
|
||||
zero, ``Sleep(0)`` is used.
|
||||
* Use ``clock_nanosleep()`` if available (resolution: 1 ns);
|
||||
* Or use ``nanosleep()`` if available (resolution: 1 ns);
|
||||
* Or use ``select()`` (resolution: 1 us).
|
||||
|
||||
On Windows, a waitable timer is used (resolution: 100 ns). If *secs* is
|
||||
zero, ``Sleep(0)`` is used.
|
||||
|
||||
.. versionchanged:: 3.11
|
||||
On Unix, the ``clock_nanosleep()`` function is now used if available.
|
||||
On Windows, a waitable timer is now used.
|
||||
On Unix, the ``clock_nanosleep()`` and ``nanosleep()`` functions are now
|
||||
used if available. On Windows, a waitable timer is now used.
|
||||
|
||||
.. versionchanged:: 3.5
|
||||
The function now sleeps at least *secs* even if the sleep is interrupted
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue