summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2021-09-25 12:36:26 (GMT)
committerGitHub <noreply@github.com>2021-09-25 12:36:26 (GMT)
commit7834ff26cbcd4d8394d64d80d9f51a364d38b1c6 (patch)
treee7c785c78db85d08be01a0f081589ea6d1a48614 /Doc
parent71f8ff45c62bd6b792919ac7c3804a8628ae12cb (diff)
downloadcpython-7834ff26cbcd4d8394d64d80d9f51a364d38b1c6.zip
cpython-7834ff26cbcd4d8394d64d80d9f51a364d38b1c6.tar.gz
cpython-7834ff26cbcd4d8394d64d80d9f51a364d38b1c6.tar.bz2
bpo-21302: Add nanosleep() implementation for time.sleep() in Unix (GH-28545)
Co-authored-by: Livius <egyszeregy@freemail.hu>
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/time.rst16
-rw-r--r--Doc/whatsnew/3.11.rst7
2 files changed, 13 insertions, 10 deletions
diff --git a/Doc/library/time.rst b/Doc/library/time.rst
index d91862c..69e5274 100644
--- a/Doc/library/time.rst
+++ b/Doc/library/time.rst
@@ -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
diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst
index 0e56b46..818208e 100644
--- a/Doc/whatsnew/3.11.rst
+++ b/Doc/whatsnew/3.11.rst
@@ -242,9 +242,10 @@ sqlite3
time
----
-* On Unix, :func:`time.sleep` now uses the ``clock_nanosleep()`` function, if
- available, which has a resolution of 1 ns (10^-6 sec), rather than using
- ``select()`` which has a resolution of 1 us (10^-9 sec).
+* On Unix, :func:`time.sleep` now uses the ``clock_nanosleep()`` or
+ ``nanosleep()`` function, if available, which has a resolution of 1 ns (10^-6
+ sec), rather than using ``select()`` which has a resolution of 1 us (10^-9
+ sec).
(Contributed by Livius and Victor Stinner in :issue:`21302`.)
* On Windows, :func:`time.sleep` now uses a waitable timer which has a