mirror of
				https://github.com/python/cpython.git
				synced 2025-11-04 11:49:12 +00:00 
			
		
		
		
	bpo-45429: Merge whatsnew about time.sleep (GH-29589)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
This commit is contained in:
		
							parent
							
								
									abc0d754c3
								
							
						
					
					
						commit
						fc4474e45e
					
				
					 2 changed files with 11 additions and 11 deletions
				
			
		| 
						 | 
					@ -362,7 +362,10 @@ Functions
 | 
				
			||||||
   On Windows, if *secs* is zero, the thread relinquishes the remainder of its
 | 
					   On Windows, if *secs* is zero, the thread relinquishes the remainder of its
 | 
				
			||||||
   time slice to any other thread that is ready to run. If there are no other
 | 
					   time slice to any other thread that is ready to run. If there are no other
 | 
				
			||||||
   threads ready to run, the function returns immediately, and the thread
 | 
					   threads ready to run, the function returns immediately, and the thread
 | 
				
			||||||
   continues execution.
 | 
					   continues execution.  On Windows 8.1 and newer the implementation uses
 | 
				
			||||||
 | 
					   a `high-resolution timer
 | 
				
			||||||
 | 
					   <https://docs.microsoft.com/en-us/windows-hardware/drivers/kernel/high-resolution-timers>`_
 | 
				
			||||||
 | 
					   which provides resolution of 100 nanoseconds. If *secs* is zero, ``Sleep(0)`` is used.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   Unix implementation:
 | 
					   Unix implementation:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -370,9 +373,6 @@ Functions
 | 
				
			||||||
   * Or use ``nanosleep()`` if available (resolution: 1 nanosecond);
 | 
					   * Or use ``nanosleep()`` if available (resolution: 1 nanosecond);
 | 
				
			||||||
   * Or use ``select()`` (resolution: 1 microsecond).
 | 
					   * Or use ``select()`` (resolution: 1 microsecond).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   On Windows, a waitable timer is used (resolution: 100 nanosecond). If *secs* is
 | 
					 | 
				
			||||||
   zero, ``Sleep(0)`` is used.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
   .. versionchanged:: 3.11
 | 
					   .. versionchanged:: 3.11
 | 
				
			||||||
      On Unix, the ``clock_nanosleep()`` and ``nanosleep()`` functions are now
 | 
					      On Unix, the ``clock_nanosleep()`` and ``nanosleep()`` functions are now
 | 
				
			||||||
      used if available. On Windows, a waitable timer is now used.
 | 
					      used if available. On Windows, a waitable timer is now used.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -269,6 +269,7 @@ threading
 | 
				
			||||||
  by system clock changes.
 | 
					  by system clock changes.
 | 
				
			||||||
  (Contributed by Victor Stinner in :issue:`41710`.)
 | 
					  (Contributed by Victor Stinner in :issue:`41710`.)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
time
 | 
					time
 | 
				
			||||||
----
 | 
					----
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -278,14 +279,13 @@ time
 | 
				
			||||||
  of 1 microsecond (10\ :sup:`-6` seconds).
 | 
					  of 1 microsecond (10\ :sup:`-6` seconds).
 | 
				
			||||||
  (Contributed by Benjamin Szőke and Victor Stinner in :issue:`21302`.)
 | 
					  (Contributed by Benjamin Szőke and Victor Stinner in :issue:`21302`.)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
* On Windows, :func:`time.sleep` now uses a waitable timer which has a
 | 
					* On Windows 8.1 and newer, :func:`time.sleep` now uses a waitable timer based
 | 
				
			||||||
  resolution of 100 nanoseconds (10\ :sup:`-7` seconds). Previously, it had
 | 
					  on `high-resolution timers
 | 
				
			||||||
  a resolution of 1 millisecond (10\ :sup:`-3` seconds).
 | 
					  <https://docs.microsoft.com/en-us/windows-hardware/drivers/kernel/high-resolution-timers>`_
 | 
				
			||||||
  (Contributed by Benjamin Szőke and Victor Stinner in :issue:`21302`.)
 | 
					  which has a resolution of 100 nanoseconds (10\ :sup:`-7` seconds). Previously,
 | 
				
			||||||
 | 
					  it had a resolution of 1 millisecond (10\ :sup:`-3` seconds).
 | 
				
			||||||
 | 
					  (Contributed by Benjamin Szőke, Dong-hee Na, Eryk Sun and Victor Stinner in :issue:`21302` and :issue:`45429`.)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
* On Windows, :func:`time.sleep` now uses a waitable timer which supports high-resolution timers.
 | 
					 | 
				
			||||||
  In Python 3.10, the best resolution was 1 ms, from Python 3.11 it's now smaller than 1 ms.
 | 
					 | 
				
			||||||
  (Contributed by Dong-hee Na and Eryk Sun in :issue:`45429`.)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
unicodedata
 | 
					unicodedata
 | 
				
			||||||
-----------
 | 
					-----------
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue