Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
1ce5573f
Commit
1ce5573f
authored
Feb 04, 2014
by
Victor Stinner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
asyncio doc: add an example to schedule a coroutine from a different thread
parent
47b0cd5d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
Doc/library/asyncio-dev.rst
Doc/library/asyncio-dev.rst
+8
-5
No files found.
Doc/library/asyncio-dev.rst
View file @
1ce5573f
...
...
@@ -13,12 +13,15 @@ Concurrency and multithreading
------------------------------
An event loop runs in a thread and executes all callbacks and tasks in the same
thread. If a callback should be scheduled from a different thread, the
:meth:`BaseEventLoop.call_soon_threadsafe` method should be used.
thread. While a task in running in the event loop, no other task is running in
the same thread. But when the task uses ``yield from``, the task is suspended
and the event loop executes the next task.
While a task in running in the event loop, no other task is running in the same
thread. But when the task uses ``yield from``, the task is suspended and the
event loop executes the next task.
To schedule a callback from a different thread, the
:meth:`BaseEventLoop.call_soon_threadsafe` method should be used. Example to
schedule a coroutine from a different::
loop.call_soon_threadsafe(asyncio.async, coro_func())
To handle signals and to execute subprocesses, the event loop must be run in
the main thread.
...
...
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