Signals¶
Signal is a list of registered asynchronous callbacks.
The signal’s life-cycle has two stages: after creation it’s content
could be filled by using standard list operations: sig.append()
etc.
After sig.freeze()
call the signal is frozen: adding, removing
and dropping callbacks are forbidden.
The only available operation is calling previously registered
callbacks by await sig.send(data)
.
For concrete usage examples see signals in aiohttp.web chapter.
Changed in version 3.0: sig.send()
call is forbidden for non-frozen signal.
Support for regular (non-async) callbacks is dropped. All callbacks should be async functions.
-
class
aiohttp.
Signal
¶ The signal, implements
collections.abc.MutableSequence
interface.-
coroutine
send
(*args, **kwargs)¶ Call all registered callbacks one by one starting from the begin of list.
-
freeze
()¶ Freeze the list. After the call any content modification is forbidden.
-
coroutine