blatann.waitables.event_queue module
- class blatann.waitables.event_queue.EventQueue(event, disconnect_event=None)
Bases:
Generic[TSender,TEvent]Iterable object which provides a stream of events dispatched on a provided
Eventobject. The iterator does not exit unless a “disconnect event” is provided, typically when a peer disconnects.- get(block=True, timeout=None)
Gets the next item in the queue. If a disconnect event occurs, the queue will return
Noneand not return any other events afterward.- Parameters:
block – True to block the current thread until the next event is received
timeout – Optional timeout to wait for the next object
- Return type:
- Returns:
The next item in the queue
- Raises:
queue.Empty if a timeout is provided and no event was received
- class blatann.waitables.event_queue.AsyncEventQueue(event, disconnect_event=None, event_loop=None)
Bases:
Generic[TSender,TEvent]Asynchronous iterable object which provides a stream of events dispatched on a provided
Eventobject. The iterator does not exit unless a “disconnect event” is provided, typically when a peer disconnects.- async get()
Asynchronously gets the next item in the queue. If a disconnect event occurs, the queue will return
Noneand not provide any other events afterward.