Skip to content
This repository was archived by the owner on May 31, 2021. It is now read-only.

* Fix the run_in_thread example, and minor fixes. #16

Merged
merged 1 commit into from
Jan 3, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions examples/run_in_thread.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import asyncio


def compute_pi(digits):
# implementation
return 3.14


async def main():
async def main(loop):
digits = await loop.run_in_executor(None, compute_pi, 20000)
print("pi: %s" % digits)


loop = asyncio.get_event_loop()
loop.run_until_complete(main())
loop.run_until_complete(main(loop))
loop.close()
2 changes: 1 addition & 1 deletion examples/synchronous_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def get_encoding(http_response):


def get_page(host, port, wait=0):
"""Get one page suppling `wait` time.
"""Get one page supplying `wait` time.

The path will be build with: `host:port/wait`
"""
Expand Down
5 changes: 2 additions & 3 deletions index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Asyncio Documentation
+++++++++++++++++++++

Chapter 1: First steps with asyncio
====================================
===================================

.. toctree::
:maxdepth: 2
Expand All @@ -18,7 +18,7 @@ Chapter 1: First steps with asyncio


Chapter 2: Advanced topics
===========================
==========================

.. toctree::
:maxdepth: 2
Expand Down Expand Up @@ -55,7 +55,6 @@ See also
* `A Web Crawler With asyncio Coroutines
<http://aosabook.org/en/500L/a-web-crawler-with-asyncio-coroutines.html>`_
by A. Jesse Jiryu Davis and Guido van Rossum
* `asyncio.org <http://asyncio.org/>`_
* `Writing Redis in Python with asyncio: Part 1
<http://jamesls.com/writing-redis-in-python-with-asyncio-part-1.html>`_
by James Saryerwinnie
Expand Down
4 changes: 2 additions & 2 deletions why_asyncio.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
++++++++++++++++++
++++++++++++++++
Why use asyncio?
++++++++++++++++++
++++++++++++++++

Why asynchronous programming?
=============================
Expand Down