Internal API Reference

Note

Internal APIs are subject to rapid change even across minor releases. This page exists to help users modify and extend the library.

Constants

Pollers

Latch

Logging

See also mitogen.core.IoLoggerProtocol.

Stream, Side & Protocol

Connection & Options

Import Mechanism

Module Finders

Routing Management

Timer Management

Context ID Allocation

Child Implementation

Process Management

Helper Functions

Subprocess Functions

Helpers

Signals

Mitogen contains a simplistic signal mechanism to decouple its components. When a signal is fired by an instance of a class, functions registered to receive it are called back.

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.

Functions

List

These signals are used internally by Mitogen.

Class

Name

Description

mitogen.core.Stream

disconnect

Fired on the Broker thread when disconnection is detected.

mitogen.core.Stream

shutdown

Fired on the Broker thread when broker shutdown begins.

mitogen.core.Context

disconnect

Fired on the Broker thread during shutdown (???)

mitogen.parent.Process

exit

Fired when mitogen.parent.Reaper detects subprocess has fully exitted.

mitogen.core.Broker

shutdown

Fired after Broker.shutdown() is called, but before shutdown event fires. This can be used to trigger any behaviour that relies on the process remaining intact, as processing of shutdown races with any parent sending the child a signal because it is not shutting down in reasonable time.

mitogen.core.Broker

shutdown

Fired after Broker.shutdown() is called.

mitogen.core.Broker

exit

Fired immediately prior to the broker thread exit.