\!/ KyuuKazami \!/

Path : /usr/share/doc/python34-docs-3.4.3/library/
Upload :
Current File : //usr/share/doc/python34-docs-3.4.3/library/asyncio-eventloops.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>18.5.2. Event loops &mdash; Python 3.4.3 documentation</title>
    
    <link rel="stylesheet" href="../_static/pydoctheme.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../',
        VERSION:     '3.4.3',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <script type="text/javascript" src="../_static/sidebar.js"></script>
    <link rel="search" type="application/opensearchdescription+xml"
          title="Search within Python 3.4.3 documentation"
          href="../_static/opensearch.xml"/>
    <link rel="author" title="About these documents" href="../about.html" />
    <link rel="copyright" title="Copyright" href="../copyright.html" />
    <link rel="top" title="Python 3.4.3 documentation" href="../index.html" />
    <link rel="up" title="18.5. asyncio – Asynchronous I/O, event loop, coroutines and tasks" href="asyncio.html" />
    <link rel="next" title="18.5.3. Tasks and coroutines" href="asyncio-task.html" />
    <link rel="prev" title="18.5.1. Base Event Loop" href="asyncio-eventloop.html" />
    <link rel="shortcut icon" type="image/png" href="../_static/py.png" />
    <script type="text/javascript" src="../_static/copybutton.js"></script>
    
    
 

  </head>
  <body>  
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="asyncio-task.html" title="18.5.3. Tasks and coroutines"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="asyncio-eventloop.html" title="18.5.1. Base Event Loop"
             accesskey="P">previous</a> |</li>
        <li><img src="../_static/py.png" alt=""
                 style="vertical-align: middle; margin-top: -1px"/></li>
        <li><a href="https://www.python.org/">Python</a> &raquo;</li>
        <li>
          <a href="../index.html">3.4.3 Documentation</a> &raquo;
        </li>

          <li><a href="index.html" >The Python Standard Library</a> &raquo;</li>
          <li><a href="ipc.html" >18. Interprocess Communication and Networking</a> &raquo;</li>
          <li><a href="asyncio.html" accesskey="U">18.5. <tt class="docutils literal"><span class="pre">asyncio</span></tt> &#8211; Asynchronous I/O, event loop, coroutines and tasks</a> &raquo;</li> 
      </ul>
    </div>    

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="event-loops">
<h1>18.5.2. Event loops<a class="headerlink" href="#event-loops" title="Permalink to this headline">¶</a></h1>
<div class="section" id="event-loop-functions">
<h2>18.5.2.1. Event loop functions<a class="headerlink" href="#event-loop-functions" title="Permalink to this headline">¶</a></h2>
<p>The following functions are convenient shortcuts to accessing the methods of the
global policy. Note that this provides access to the default policy, unless an
alternative policy was set by calling <a class="reference internal" href="#asyncio.set_event_loop_policy" title="asyncio.set_event_loop_policy"><tt class="xref py py-func docutils literal"><span class="pre">set_event_loop_policy()</span></tt></a> earlier in
the execution of the process.</p>
<dl class="function">
<dt id="asyncio.get_event_loop">
<tt class="descclassname">asyncio.</tt><tt class="descname">get_event_loop</tt><big>(</big><big>)</big><a class="headerlink" href="#asyncio.get_event_loop" title="Permalink to this definition">¶</a></dt>
<dd><p>Equivalent to calling <tt class="docutils literal"><span class="pre">get_event_loop_policy().get_event_loop()</span></tt>.</p>
</dd></dl>

<dl class="function">
<dt id="asyncio.set_event_loop">
<tt class="descclassname">asyncio.</tt><tt class="descname">set_event_loop</tt><big>(</big><em>loop</em><big>)</big><a class="headerlink" href="#asyncio.set_event_loop" title="Permalink to this definition">¶</a></dt>
<dd><p>Equivalent to calling <tt class="docutils literal"><span class="pre">get_event_loop_policy().set_event_loop(loop)</span></tt>.</p>
</dd></dl>

<dl class="function">
<dt id="asyncio.new_event_loop">
<tt class="descclassname">asyncio.</tt><tt class="descname">new_event_loop</tt><big>(</big><big>)</big><a class="headerlink" href="#asyncio.new_event_loop" title="Permalink to this definition">¶</a></dt>
<dd><p>Equivalent to calling <tt class="docutils literal"><span class="pre">get_event_loop_policy().new_event_loop()</span></tt>.</p>
</dd></dl>

</div>
<div class="section" id="available-event-loops">
<span id="asyncio-event-loops"></span><h2>18.5.2.2. Available event loops<a class="headerlink" href="#available-event-loops" title="Permalink to this headline">¶</a></h2>
<p>asyncio currently provides two implementations of event loops:
<a class="reference internal" href="#asyncio.SelectorEventLoop" title="asyncio.SelectorEventLoop"><tt class="xref py py-class docutils literal"><span class="pre">SelectorEventLoop</span></tt></a> and <a class="reference internal" href="#asyncio.ProactorEventLoop" title="asyncio.ProactorEventLoop"><tt class="xref py py-class docutils literal"><span class="pre">ProactorEventLoop</span></tt></a>.</p>
<dl class="class">
<dt id="asyncio.SelectorEventLoop">
<em class="property">class </em><tt class="descclassname">asyncio.</tt><tt class="descname">SelectorEventLoop</tt><a class="headerlink" href="#asyncio.SelectorEventLoop" title="Permalink to this definition">¶</a></dt>
<dd><p>Event loop based on the <a class="reference internal" href="selectors.html#module-selectors" title="selectors: High-level I/O multiplexing."><tt class="xref py py-mod docutils literal"><span class="pre">selectors</span></tt></a> module. Subclass of
<a class="reference internal" href="asyncio-eventloop.html#asyncio.BaseEventLoop" title="asyncio.BaseEventLoop"><tt class="xref py py-class docutils literal"><span class="pre">BaseEventLoop</span></tt></a>.</p>
<p>Use the most efficient selector available on the platform.</p>
<p>On Windows, only sockets are supported (ex: pipes are not supported):
see the <a class="reference external" href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms740141%28v=vs.85%29.aspx">MSDN documentation of select</a>.</p>
</dd></dl>

<dl class="class">
<dt id="asyncio.ProactorEventLoop">
<em class="property">class </em><tt class="descclassname">asyncio.</tt><tt class="descname">ProactorEventLoop</tt><a class="headerlink" href="#asyncio.ProactorEventLoop" title="Permalink to this definition">¶</a></dt>
<dd><p>Proactor event loop for Windows using &#8220;I/O Completion Ports&#8221; aka IOCP.
Subclass of <a class="reference internal" href="asyncio-eventloop.html#asyncio.BaseEventLoop" title="asyncio.BaseEventLoop"><tt class="xref py py-class docutils literal"><span class="pre">BaseEventLoop</span></tt></a>.</p>
<p>Availability: Windows.</p>
<div class="admonition seealso">
<p class="first admonition-title">See also</p>
<p class="last"><a class="reference external" href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa365198%28v=vs.85%29.aspx">MSDN documentation on I/O Completion Ports</a>.</p>
</div>
</dd></dl>

<p>Example to use a <a class="reference internal" href="#asyncio.ProactorEventLoop" title="asyncio.ProactorEventLoop"><tt class="xref py py-class docutils literal"><span class="pre">ProactorEventLoop</span></tt></a> on Windows:</p>
<div class="highlight-python3"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">asyncio</span><span class="o">,</span> <span class="nn">os</span>

<span class="k">if</span> <span class="n">os</span><span class="o">.</span><span class="n">name</span> <span class="o">==</span> <span class="s">&#39;nt&#39;</span><span class="p">:</span>
    <span class="n">loop</span> <span class="o">=</span> <span class="n">asyncio</span><span class="o">.</span><span class="n">ProactorEventLoop</span><span class="p">()</span>
    <span class="n">asyncio</span><span class="o">.</span><span class="n">set_event_loop</span><span class="p">(</span><span class="n">loop</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="section" id="platform-support">
<span id="asyncio-platform-support"></span><h2>18.5.2.3. Platform support<a class="headerlink" href="#platform-support" title="Permalink to this headline">¶</a></h2>
<p>The <a class="reference internal" href="asyncio.html#module-asyncio" title="asyncio: Asynchronous I/O, event loop, coroutines and tasks."><tt class="xref py py-mod docutils literal"><span class="pre">asyncio</span></tt></a> module has been designed to be portable, but each platform
still has subtle differences and may not support all <a class="reference internal" href="asyncio.html#module-asyncio" title="asyncio: Asynchronous I/O, event loop, coroutines and tasks."><tt class="xref py py-mod docutils literal"><span class="pre">asyncio</span></tt></a> features.</p>
<div class="section" id="windows">
<h3>18.5.2.3.1. Windows<a class="headerlink" href="#windows" title="Permalink to this headline">¶</a></h3>
<p>Common limits of Windows event loops:</p>
<ul class="simple">
<li><a class="reference internal" href="asyncio-eventloop.html#asyncio.BaseEventLoop.create_unix_connection" title="asyncio.BaseEventLoop.create_unix_connection"><tt class="xref py py-meth docutils literal"><span class="pre">create_unix_connection()</span></tt></a> and
<a class="reference internal" href="asyncio-eventloop.html#asyncio.BaseEventLoop.create_unix_server" title="asyncio.BaseEventLoop.create_unix_server"><tt class="xref py py-meth docutils literal"><span class="pre">create_unix_server()</span></tt></a> are not supported: the socket
family <a class="reference internal" href="socket.html#socket.AF_UNIX" title="socket.AF_UNIX"><tt class="xref py py-data docutils literal"><span class="pre">socket.AF_UNIX</span></tt></a> is specific to UNIX</li>
<li><a class="reference internal" href="asyncio-eventloop.html#asyncio.BaseEventLoop.add_signal_handler" title="asyncio.BaseEventLoop.add_signal_handler"><tt class="xref py py-meth docutils literal"><span class="pre">add_signal_handler()</span></tt></a> and
<a class="reference internal" href="asyncio-eventloop.html#asyncio.BaseEventLoop.remove_signal_handler" title="asyncio.BaseEventLoop.remove_signal_handler"><tt class="xref py py-meth docutils literal"><span class="pre">remove_signal_handler()</span></tt></a> are not supported</li>
<li><tt class="xref py py-meth docutils literal"><span class="pre">EventLoopPolicy.set_child_watcher()</span></tt> is not supported.
<a class="reference internal" href="#asyncio.ProactorEventLoop" title="asyncio.ProactorEventLoop"><tt class="xref py py-class docutils literal"><span class="pre">ProactorEventLoop</span></tt></a> supports subprocesses. It has only one
implementation to watch child processes, there is no need to configure it.</li>
</ul>
<p><a class="reference internal" href="#asyncio.SelectorEventLoop" title="asyncio.SelectorEventLoop"><tt class="xref py py-class docutils literal"><span class="pre">SelectorEventLoop</span></tt></a> specific limits:</p>
<ul class="simple">
<li><a class="reference internal" href="selectors.html#selectors.SelectSelector" title="selectors.SelectSelector"><tt class="xref py py-class docutils literal"><span class="pre">SelectSelector</span></tt></a> is used which only supports sockets
and is limited to 512 sockets.</li>
<li><a class="reference internal" href="asyncio-eventloop.html#asyncio.BaseEventLoop.add_reader" title="asyncio.BaseEventLoop.add_reader"><tt class="xref py py-meth docutils literal"><span class="pre">add_reader()</span></tt></a> and <a class="reference internal" href="asyncio-eventloop.html#asyncio.BaseEventLoop.add_writer" title="asyncio.BaseEventLoop.add_writer"><tt class="xref py py-meth docutils literal"><span class="pre">add_writer()</span></tt></a> only
accept file descriptors of sockets</li>
<li>Pipes are not supported
(ex: <a class="reference internal" href="asyncio-eventloop.html#asyncio.BaseEventLoop.connect_read_pipe" title="asyncio.BaseEventLoop.connect_read_pipe"><tt class="xref py py-meth docutils literal"><span class="pre">connect_read_pipe()</span></tt></a>,
<a class="reference internal" href="asyncio-eventloop.html#asyncio.BaseEventLoop.connect_write_pipe" title="asyncio.BaseEventLoop.connect_write_pipe"><tt class="xref py py-meth docutils literal"><span class="pre">connect_write_pipe()</span></tt></a>)</li>
<li><a class="reference internal" href="asyncio-subprocess.html#asyncio-subprocess"><em>Subprocesses</em></a> are not supported
(ex: <a class="reference internal" href="asyncio-subprocess.html#asyncio.BaseEventLoop.subprocess_exec" title="asyncio.BaseEventLoop.subprocess_exec"><tt class="xref py py-meth docutils literal"><span class="pre">subprocess_exec()</span></tt></a>,
<a class="reference internal" href="asyncio-subprocess.html#asyncio.BaseEventLoop.subprocess_shell" title="asyncio.BaseEventLoop.subprocess_shell"><tt class="xref py py-meth docutils literal"><span class="pre">subprocess_shell()</span></tt></a>)</li>
</ul>
<p><a class="reference internal" href="#asyncio.ProactorEventLoop" title="asyncio.ProactorEventLoop"><tt class="xref py py-class docutils literal"><span class="pre">ProactorEventLoop</span></tt></a> specific limits:</p>
<ul class="simple">
<li>SSL is not supported: <a class="reference internal" href="asyncio-eventloop.html#asyncio.BaseEventLoop.create_connection" title="asyncio.BaseEventLoop.create_connection"><tt class="xref py py-meth docutils literal"><span class="pre">create_connection()</span></tt></a> and
<a class="reference internal" href="asyncio-eventloop.html#asyncio.BaseEventLoop.create_server" title="asyncio.BaseEventLoop.create_server"><tt class="xref py py-meth docutils literal"><span class="pre">create_server()</span></tt></a> cannot be used with SSL for example</li>
<li><a class="reference internal" href="asyncio-eventloop.html#asyncio.BaseEventLoop.create_datagram_endpoint" title="asyncio.BaseEventLoop.create_datagram_endpoint"><tt class="xref py py-meth docutils literal"><span class="pre">create_datagram_endpoint()</span></tt></a> (UDP) is not supported</li>
<li><a class="reference internal" href="asyncio-eventloop.html#asyncio.BaseEventLoop.add_reader" title="asyncio.BaseEventLoop.add_reader"><tt class="xref py py-meth docutils literal"><span class="pre">add_reader()</span></tt></a> and <a class="reference internal" href="asyncio-eventloop.html#asyncio.BaseEventLoop.add_writer" title="asyncio.BaseEventLoop.add_writer"><tt class="xref py py-meth docutils literal"><span class="pre">add_writer()</span></tt></a> are
not supported</li>
</ul>
<p>The resolution of the monotonic clock on Windows is usually around 15.6 msec.
The best resolution is 0.5 msec. The resolution depends on the hardware
(availability of <a class="reference external" href="http://fr.wikipedia.org/wiki/High_Precision_Event_Timer">HPET</a>) and on the Windows
configuration. See <a class="reference internal" href="asyncio-eventloop.html#asyncio-delayed-calls"><em>asyncio delayed calls</em></a>.</p>
</div>
<div class="section" id="mac-os-x">
<h3>18.5.2.3.2. Mac OS X<a class="headerlink" href="#mac-os-x" title="Permalink to this headline">¶</a></h3>
<p>Character devices like PTY are only well supported since Mavericks (Mac OS
10.9). They are not supported at all on Mac OS 10.5 and older.</p>
<p>On Mac OS 10.6, 10.7 and 10.8, the default event loop is
<a class="reference internal" href="#asyncio.SelectorEventLoop" title="asyncio.SelectorEventLoop"><tt class="xref py py-class docutils literal"><span class="pre">SelectorEventLoop</span></tt></a> which uses <a class="reference internal" href="selectors.html#selectors.KqueueSelector" title="selectors.KqueueSelector"><tt class="xref py py-class docutils literal"><span class="pre">selectors.KqueueSelector</span></tt></a>.
<a class="reference internal" href="selectors.html#selectors.KqueueSelector" title="selectors.KqueueSelector"><tt class="xref py py-class docutils literal"><span class="pre">selectors.KqueueSelector</span></tt></a> does not support character devices on these
versions.  The <a class="reference internal" href="#asyncio.SelectorEventLoop" title="asyncio.SelectorEventLoop"><tt class="xref py py-class docutils literal"><span class="pre">SelectorEventLoop</span></tt></a> can be used with
<a class="reference internal" href="selectors.html#selectors.SelectSelector" title="selectors.SelectSelector"><tt class="xref py py-class docutils literal"><span class="pre">SelectSelector</span></tt></a> or <a class="reference internal" href="selectors.html#selectors.PollSelector" title="selectors.PollSelector"><tt class="xref py py-class docutils literal"><span class="pre">PollSelector</span></tt></a> to
support character devices on these versions of Mac OS X. Example:</p>
<div class="highlight-python3"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">asyncio</span>
<span class="kn">import</span> <span class="nn">selectors</span>

<span class="n">selector</span> <span class="o">=</span> <span class="n">selectors</span><span class="o">.</span><span class="n">SelectSelector</span><span class="p">()</span>
<span class="n">loop</span> <span class="o">=</span> <span class="n">asyncio</span><span class="o">.</span><span class="n">SelectorEventLoop</span><span class="p">(</span><span class="n">selector</span><span class="p">)</span>
<span class="n">asyncio</span><span class="o">.</span><span class="n">set_event_loop</span><span class="p">(</span><span class="n">loop</span><span class="p">)</span>
</pre></div>
</div>
</div>
</div>
<div class="section" id="event-loop-policies-and-the-default-policy">
<h2>18.5.2.4. Event loop policies and the default policy<a class="headerlink" href="#event-loop-policies-and-the-default-policy" title="Permalink to this headline">¶</a></h2>
<p>Event loop management is abstracted with a <em>policy</em> pattern, to provide maximal
flexibility for custom platforms and frameworks. Throughout the execution of a
process, a single global policy object manages the event loops available to the
process based on the calling context. A policy is an object implementing the
<a class="reference internal" href="#asyncio.AbstractEventLoopPolicy" title="asyncio.AbstractEventLoopPolicy"><tt class="xref py py-class docutils literal"><span class="pre">AbstractEventLoopPolicy</span></tt></a> interface.</p>
<p>For most users of <a class="reference internal" href="asyncio.html#module-asyncio" title="asyncio: Asynchronous I/O, event loop, coroutines and tasks."><tt class="xref py py-mod docutils literal"><span class="pre">asyncio</span></tt></a>, policies never have to be dealt with
explicitly, since the default global policy is sufficient.</p>
<p>The default policy defines context as the current thread, and manages an event
loop per thread that interacts with <a class="reference internal" href="asyncio.html#module-asyncio" title="asyncio: Asynchronous I/O, event loop, coroutines and tasks."><tt class="xref py py-mod docutils literal"><span class="pre">asyncio</span></tt></a>. The module-level functions
<a class="reference internal" href="#asyncio.get_event_loop" title="asyncio.get_event_loop"><tt class="xref py py-func docutils literal"><span class="pre">get_event_loop()</span></tt></a> and <a class="reference internal" href="#asyncio.set_event_loop" title="asyncio.set_event_loop"><tt class="xref py py-func docutils literal"><span class="pre">set_event_loop()</span></tt></a> provide convenient access to
event loops managed by the default policy.</p>
</div>
<div class="section" id="event-loop-policy-interface">
<h2>18.5.2.5. Event loop policy interface<a class="headerlink" href="#event-loop-policy-interface" title="Permalink to this headline">¶</a></h2>
<p>An event loop policy must implement the following interface:</p>
<dl class="class">
<dt id="asyncio.AbstractEventLoopPolicy">
<em class="property">class </em><tt class="descclassname">asyncio.</tt><tt class="descname">AbstractEventLoopPolicy</tt><a class="headerlink" href="#asyncio.AbstractEventLoopPolicy" title="Permalink to this definition">¶</a></dt>
<dd><p>Event loop policy.</p>
<dl class="method">
<dt id="asyncio.AbstractEventLoopPolicy.get_event_loop">
<tt class="descname">get_event_loop</tt><big>(</big><big>)</big><a class="headerlink" href="#asyncio.AbstractEventLoopPolicy.get_event_loop" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the event loop for the current context.</p>
<p>Returns an event loop object implementing the <a class="reference internal" href="asyncio-eventloop.html#asyncio.BaseEventLoop" title="asyncio.BaseEventLoop"><tt class="xref py py-class docutils literal"><span class="pre">BaseEventLoop</span></tt></a>
interface.</p>
<p>Raises an exception in case no event loop has been set for the current
context and the current policy does not specify to create one. It must
never return <tt class="docutils literal"><span class="pre">None</span></tt>.</p>
</dd></dl>

<dl class="method">
<dt id="asyncio.AbstractEventLoopPolicy.set_event_loop">
<tt class="descname">set_event_loop</tt><big>(</big><em>loop</em><big>)</big><a class="headerlink" href="#asyncio.AbstractEventLoopPolicy.set_event_loop" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the event loop for the current context to <em>loop</em>.</p>
</dd></dl>

<dl class="method">
<dt id="asyncio.AbstractEventLoopPolicy.new_event_loop">
<tt class="descname">new_event_loop</tt><big>(</big><big>)</big><a class="headerlink" href="#asyncio.AbstractEventLoopPolicy.new_event_loop" title="Permalink to this definition">¶</a></dt>
<dd><p>Create and return a new event loop object according to this policy&#8217;s
rules.</p>
<p>If there&#8217;s need to set this loop as the event loop for the current
context, <a class="reference internal" href="#asyncio.set_event_loop" title="asyncio.set_event_loop"><tt class="xref py py-meth docutils literal"><span class="pre">set_event_loop()</span></tt></a> must be called explicitly.</p>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="access-to-the-global-loop-policy">
<h2>18.5.2.6. Access to the global loop policy<a class="headerlink" href="#access-to-the-global-loop-policy" title="Permalink to this headline">¶</a></h2>
<dl class="function">
<dt id="asyncio.get_event_loop_policy">
<tt class="descclassname">asyncio.</tt><tt class="descname">get_event_loop_policy</tt><big>(</big><big>)</big><a class="headerlink" href="#asyncio.get_event_loop_policy" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the current event loop policy.</p>
</dd></dl>

<dl class="function">
<dt id="asyncio.set_event_loop_policy">
<tt class="descclassname">asyncio.</tt><tt class="descname">set_event_loop_policy</tt><big>(</big><em>policy</em><big>)</big><a class="headerlink" href="#asyncio.set_event_loop_policy" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the current event loop policy. If <em>policy</em> is <tt class="docutils literal"><span class="pre">None</span></tt>, the default
policy is restored.</p>
</dd></dl>

</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
  <h3><a href="../contents.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">18.5.2. Event loops</a><ul>
<li><a class="reference internal" href="#event-loop-functions">18.5.2.1. Event loop functions</a></li>
<li><a class="reference internal" href="#available-event-loops">18.5.2.2. Available event loops</a></li>
<li><a class="reference internal" href="#platform-support">18.5.2.3. Platform support</a><ul>
<li><a class="reference internal" href="#windows">18.5.2.3.1. Windows</a></li>
<li><a class="reference internal" href="#mac-os-x">18.5.2.3.2. Mac OS X</a></li>
</ul>
</li>
<li><a class="reference internal" href="#event-loop-policies-and-the-default-policy">18.5.2.4. Event loop policies and the default policy</a></li>
<li><a class="reference internal" href="#event-loop-policy-interface">18.5.2.5. Event loop policy interface</a></li>
<li><a class="reference internal" href="#access-to-the-global-loop-policy">18.5.2.6. Access to the global loop policy</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="asyncio-eventloop.html"
                        title="previous chapter">18.5.1. Base Event Loop</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="asyncio-task.html"
                        title="next chapter">18.5.3. Tasks and coroutines</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
  <li><a href="../bugs.html">Report a Bug</a></li>
  <li><a href="../_sources/library/asyncio-eventloops.txt"
         rel="nofollow">Show Source</a></li>
</ul>

<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>  
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="asyncio-task.html" title="18.5.3. Tasks and coroutines"
             >next</a> |</li>
        <li class="right" >
          <a href="asyncio-eventloop.html" title="18.5.1. Base Event Loop"
             >previous</a> |</li>
        <li><img src="../_static/py.png" alt=""
                 style="vertical-align: middle; margin-top: -1px"/></li>
        <li><a href="https://www.python.org/">Python</a> &raquo;</li>
        <li>
          <a href="../index.html">3.4.3 Documentation</a> &raquo;
        </li>

          <li><a href="index.html" >The Python Standard Library</a> &raquo;</li>
          <li><a href="ipc.html" >18. Interprocess Communication and Networking</a> &raquo;</li>
          <li><a href="asyncio.html" >18.5. <tt class="docutils literal"><span class="pre">asyncio</span></tt> &#8211; Asynchronous I/O, event loop, coroutines and tasks</a> &raquo;</li> 
      </ul>
    </div>  
    <div class="footer">
    &copy; <a href="../copyright.html">Copyright</a> 1990-2015, Python Software Foundation.
    <br />
    The Python Software Foundation is a non-profit corporation.
    <a href="https://www.python.org/psf/donations/">Please donate.</a>
    <br />
    Last updated on Feb 25, 2015.
    <a href="../bugs.html">Found a bug</a>?
    <br />
    Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.2.3.
    </div>

  </body>
</html>

@KyuuKazami