@@ -367,6 +367,8 @@ Functions
367
367
The suspension time may be longer than requested by an arbitrary amount,
368
368
because of the scheduling of other activity in the system.
369
369
370
+ .. rubric :: Windows implementation
371
+
370
372
On Windows, if *secs * is zero, the thread relinquishes the remainder of its
371
373
time slice to any other thread that is ready to run. If there are no other
372
374
threads ready to run, the function returns immediately, and the thread
@@ -375,12 +377,19 @@ Functions
375
377
<https://learn.microsoft.com/windows-hardware/drivers/kernel/high-resolution-timers> `_
376
378
which provides resolution of 100 nanoseconds. If *secs * is zero, ``Sleep(0) `` is used.
377
379
378
- Unix implementation:
380
+ .. rubric :: Unix implementation
379
381
380
382
* Use ``clock_nanosleep() `` if available (resolution: 1 nanosecond);
381
383
* Or use ``nanosleep() `` if available (resolution: 1 nanosecond);
382
384
* Or use ``select() `` (resolution: 1 microsecond).
383
385
386
+ .. note ::
387
+
388
+ To emulate a "no-op", use :keyword: `pass ` instead of ``time.sleep(0) ``.
389
+
390
+ To voluntarily relinquish the CPU, specify a real-time :ref: `scheduling
391
+ policy <os-scheduling-policy>` and use :func: `os.sched_yield ` instead.
392
+
384
393
.. versionchanged :: 3.5
385
394
The function now sleeps at least *secs * even if the sleep is interrupted
386
395
by a signal, except if the signal handler raises an exception (see
0 commit comments