2018-02-27 18:22:58 +00:00
|
|
|
|
2018-05-04 02:47:29 +00:00
|
|
|
.. _signals:
|
|
|
|
|
2018-02-27 18:22:58 +00:00
|
|
|
Signals
|
|
|
|
=======
|
|
|
|
|
2018-05-04 02:47:29 +00:00
|
|
|
Mitogen contains a simplistic signal mechanism to help decouple its internal
|
2018-03-23 11:07:54 +00:00
|
|
|
components. When a signal is fired by a particular instance of a class, any
|
|
|
|
functions registered to receive it will be called back.
|
|
|
|
|
2018-05-04 02:47:29 +00:00
|
|
|
.. warning::
|
|
|
|
|
|
|
|
As signals execute on the Broker thread, and without exception handling,
|
|
|
|
they are generally unsafe for consumption by user code, as any bugs could
|
|
|
|
trigger crashes and hangs for which the broker is unable to forward logs,
|
|
|
|
or ensure the buggy context always shuts down on disconnect.
|
|
|
|
|
2018-03-23 11:07:54 +00:00
|
|
|
|
|
|
|
Functions
|
|
|
|
---------
|
|
|
|
|
2018-08-18 13:15:37 +00:00
|
|
|
.. currentmodule:: mitogen.core
|
2018-03-23 11:07:54 +00:00
|
|
|
|
2018-08-18 13:15:37 +00:00
|
|
|
.. autofunction:: listen
|
|
|
|
.. autofunction:: fire
|
2018-03-23 11:07:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
List
|
|
|
|
----
|
|
|
|
|
|
|
|
These signals are used internally by Mitogen.
|
2018-02-27 18:22:58 +00:00
|
|
|
|
|
|
|
.. list-table::
|
|
|
|
:header-rows: 1
|
|
|
|
:widths: auto
|
|
|
|
|
|
|
|
* - Class
|
|
|
|
- Name
|
|
|
|
- Description
|
|
|
|
|
|
|
|
* - :py:class:`mitogen.core.Stream`
|
|
|
|
- ``disconnect``
|
|
|
|
- Fired on the Broker thread when disconnection is detected.
|
|
|
|
|
|
|
|
* - :py:class:`mitogen.core.Context`
|
|
|
|
- ``disconnect``
|
|
|
|
- Fired on the Broker thread during shutdown (???)
|
|
|
|
|
|
|
|
* - :py:class:`mitogen.core.Router`
|
|
|
|
- ``shutdown``
|
|
|
|
- Fired on the Broker thread after Broker.shutdown() is called.
|
|
|
|
|
|
|
|
* - :py:class:`mitogen.core.Broker`
|
|
|
|
- ``shutdown``
|
|
|
|
- Fired after Broker.shutdown() is called.
|
|
|
|
|
|
|
|
* - :py:class:`mitogen.core.Broker`
|
|
|
|
- ``exit``
|
|
|
|
- Fired immediately prior to the broker thread exit.
|
|
|
|
|