Multiple-producer-multiple-consumer signal-dispatching.
``dispatcher`` is the core of Louie, providing the primary API and the
core logic for the system.
Internal attributes:
- ``WEAKREF_TYPES``: Tuple of types/classes which represent weak
references to receivers, and thus must be dereferenced on retrieval
to retrieve the callable object
- ``connections``::
{ senderkey (id) : { signal : [receivers...] } }
- ``senders``: Used for cleaning up sender references on sender
deletion::
{ senderkey (id) : weakref(sender) }
- ``senders_back``: Used for cleaning up receiver references on receiver
deletion::
{ receiverkey (id) : [senderkey (id)...] }
| Function | print_stats | Undocumented |
| Function | get_receivers | Get list of receivers from global tables. |
| Function | live_receivers | Filter sequence of receivers to get resolved, live receivers. |
Get list of receivers from global tables.
This function allows you to retrieve the raw list of receivers from the connections table for the given sender and signal pair.
Note: There is no guarantee that this is the actual list stored in the connections table, so the value should be treated as a simple iterable/truth value rather than, for instance a list to which you might append new records.
Normally you would use ``live_receivers(get_receivers(...))`` to retrieve the actual receiver objects as an iterable object.Filter sequence of receivers to get resolved, live receivers.
This is a generator which will iterate over the passed sequence, checking for weak references and resolving them, then returning all live receivers.Kill old ``senders_back`` references from ``receiver``.
This guards against multiple registration of the same receiver for a given signal and sender leaking memory as old back reference records build up.
Also removes old receiver instance from receivers.