loop¶
- class EventloopMixin[source]¶
Mixin to provide common asyncio zmq scaffolding to networked classes.
Inheriting classes should, in order
call the
_init_loopmethod to create the eventloop, context, and pollerpopulate the private
_socketsand_receiversdictsawait the
_poll_socketsmethod, which polls indefinitely.
Inheriting classes must ensure that
_init_loopis called in the thread it is intended to run in, and that thread must already have a running eventloop. asyncio eventloops (and most of asyncio) are not thread safe.To help avoid cross-threading issues, the
context()andloop()properties do not automatically create the objects, raising aRuntimeErrorif they are accessed before_init_loopis called.- property context: Context¶
- property loop: AbstractEventLoop¶
- register_socket(name: str, socket: Socket, receiver: bool = False) None[source]¶
Register a socket, optionally declaring it as a receiver socket to poll