Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
45b27ed5
Kaydet (Commit)
45b27ed5
authored
Şub 01, 2014
tarafından
Victor Stinner
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
asyncio doc: document the granularity of the event loop
Improve also the "Logging" section
üst
55effc6d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
7 deletions
+31
-7
asyncio-dev.rst
Doc/library/asyncio-dev.rst
+11
-6
asyncio-eventloop.rst
Doc/library/asyncio-eventloop.rst
+17
-1
asyncio-task.rst
Doc/library/asyncio-task.rst
+3
-0
No files found.
Doc/library/asyncio-dev.rst
Dosyayı görüntüle @
45b27ed5
...
...
@@ -7,6 +7,8 @@ Asynchronous programming is different than classical "sequential" programming.
This page lists common traps and explains how to avoid them.
.. _asyncio-handle-blocking:
Handle correctly blocking functions
-----------------------------------
...
...
@@ -21,17 +23,20 @@ An executor can be used to run a task in a different thread or even in a
different process, to not block the thread of the event loop. See the
:func:`BaseEventLoop.run_in_executor` function.
.. seealso::
.. _asyncio-logger:
The :ref:`Delayed calls <asyncio-delayed-calls>` section details how the
event loop handles time.
Logger
------
.. data:: asyncio.logger.log
.. _asyncio-logger:
Logging
-------
:class:`logging.Logger` instance used by :mod:`asyncio` to log messages.
The :mod:`asyncio` module logs information with the :mod:`logging` module in
the logger ``'asyncio'``.
The logger name is ``'asyncio'``.
.. _asyncio-coroutine-not-scheduled:
...
...
Doc/library/asyncio-eventloop.rst
Dosyayı görüntüle @
45b27ed5
...
...
@@ -108,6 +108,8 @@ Calls
Like :meth:`call_soon`, but thread safe.
.. _asyncio-delayed-calls:
Delayed calls
-------------
...
...
@@ -116,6 +118,20 @@ Which clock is used depends on the (platform-specific) event loop
implementation; ideally it is a monotonic clock. This will generally be
a different clock than :func:`time.time`.
The granularity of the event loop depends on the resolution of the
:meth:`~BaseEventLoop.time` method and the resolution of the selector. It is
usually between 1 ms and 16 ms. For example, a granularity of 1 ms means that
in the best case, the difference between the expected delay and the real
elapsed time is between -1 ms and +1 ms: a call scheduled in 1 nanosecond may
be called in 1 ms, and a call scheduled in 100 ms may be called in 99 ms.
The granularity is the best difference in theory. In practice, it depends on
the system load and the the time taken by tasks executed by the event loop.
For example, if a task blocks the event loop for 1 second, all tasks scheduled
in this second will be delayed. The :ref:`Handle correctly blocking functions
<asyncio-handle-blocking>` section explains how to avoid such issue.
.. method:: BaseEventLoop.call_later(delay, callback, *args)
Arrange for the *callback* to be called after the given *delay*
...
...
@@ -290,7 +306,7 @@ Run subprocesses asynchronously using the :mod:`subprocess` module.
On Windows, the default event loop uses
:class:`selectors.SelectSelector` which only supports sockets. The
:class:`ProactorEventLoop` should be used
instead
.
:class:`ProactorEventLoop` should be used
to support subprocesses
.
.. note::
...
...
Doc/library/asyncio-task.rst
Dosyayı görüntüle @
45b27ed5
...
...
@@ -441,6 +441,9 @@ Task functions
time (in seconds). If *result* is provided, it is produced to the caller
when the coroutine completes.
The resolution of the sleep depends on the :ref:`granularity of the event
loop <asyncio-delayed-calls>`.
.. function:: shield(arg, \*, loop=None)
Wait for a future, shielding it from cancellation.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment