Main queue processor

async def _task(self):
        """ Main queue processor """

        if self._handlers.values():
            start_tasks = [h.start() for h in self._handlers.values()]
            await asyncio.wait(start_tasks, loop=self.loop)

        while self.running:
            if self.events:
                event, kwargs = await self._queue.get()
                handler = self._handlers.get(event, None)
                if handler:
                    handler(kwargs)
            else:
                # Resume on either the next `trigger` call or a `stop`
                await self._resume_processing.wait()
                self._resume_processing.clear()

        # Give all the handlers a chance to complete their pending tasks
        tasks = [handler.stop() for handler in self._handlers.values()]
        if tasks:
            await asyncio.wait(tasks, loop=self.loop)

        # Let the shutdown process continue
        await self._complete_shutdown()