Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mitogen
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
mitogen
Commits
709b38c3
Commit
709b38c3
authored
Oct 05, 2017
by
David Wilson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
docs: Getting started tidyups
parent
dcc45bc7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
15 deletions
+18
-15
docs/getting_started.rst
docs/getting_started.rst
+18
-15
No files found.
docs/getting_started.rst
View file @
709b38c3
...
@@ -27,11 +27,11 @@ and possibly your team with:
...
@@ -27,11 +27,11 @@ and possibly your team with:
* While high-level abstractions are provided, you must understand how Mitogen
* While high-level abstractions are provided, you must understand how Mitogen
works before depending on it. Mitogen interacts with many aspects of the
works before depending on it. Mitogen interacts with many aspects of the
operating system, network, SSH, sudo, sockets, TTYs,
Python runtime, and
operating system, network, SSH, sudo, sockets, TTYs,
shell, Python runtime,
timing and ordering uncertainty introduced through interaction with the
and
timing and ordering uncertainty introduced through interaction with the
network and OS scheduling.
network and OS scheduling.
Knowledge of this domain is typically gained through painful years of
ugly
Knowledge of this domain is typically gained through painful years of
failed
attempts hacking system-level programs, and learning through continual
attempts hacking system-level programs, and learning through continual
suffering how to debug the messes left behind. If you feel you lack resources
suffering how to debug the messes left behind. If you feel you lack resources
to diagnose problems independently, Mitogen is not appropriate, prefer a
to diagnose problems independently, Mitogen is not appropriate, prefer a
...
@@ -56,22 +56,25 @@ them to a callback from the broker thread (registered by
...
@@ -56,22 +56,25 @@ them to a callback from the broker thread (registered by
:py:meth:`add_handler() <mitogen.core.Router.add_handler>`), or forwarding them
:py:meth:`add_handler() <mitogen.core.Router.add_handler>`), or forwarding them
to a :py:class:`Stream <mitogen.core.Stream>`. See :ref:`routing` for an
to a :py:class:`Stream <mitogen.core.Stream>`. See :ref:`routing` for an
in-depth description. :py:class:`Router` also doubles as the entry point to
in-depth description. :py:class:`Router` also doubles as the entry point to
Mitogen's public API
.
Mitogen's public API
:
.. code-block:: python
.. code-block:: python
broker = mitogen.master.Broker()
>>> import mitogen.master
router = mitogen.master.Router(broker)
try:
>>> broker = mitogen.master.Broker()
# Your code here.
>>> router = mitogen.master.Router(broker)
finally:
broker.shutdown()
>>> try:
... # Your code here.
... pass
... finally:
... broker.shutdown()
As
your program will not exit if threads are still running when the main thread
As
Python will not stop if threads still exist after the main thread exits,
exits, it is crucial :py:meth:`Broker.shutdown` is called reliably at exit.
:py:meth:`Broker.shutdown` must be called reliably at exit. Helpers are
Helpers are provided by :py:mod:`mitogen.utils` to ensure :py:class:`Broker` is
provided by :py:mod:`mitogen.utils` to ensure :py:class:`Broker` is reliably
reliably
destroyed:
destroyed:
.. code-block:: python
.. code-block:: python
...
@@ -82,7 +85,7 @@ reliably destroyed:
...
@@ -82,7 +85,7 @@ reliably destroyed:
If your program cannot live beneath :py:func:`mitogen.utils.run_with_router` on
If your program cannot live beneath :py:func:`mitogen.utils.run_with_router` on
the stack, you must must arrange for :py:meth:`Broker.shutdown` to be called
the stack, you must must arrange for :py:meth:`Broker.shutdown` to be called
anywhere
exit of the main thread may be triggered
.
anywhere
the main thread may exit
.
Creating A Context
Creating A Context
...
...
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