actor.py 文件源码

python
阅读 35 收藏 0 点赞 0 评论 0

项目:felix 作者: axbaretto 项目源码 文件源码
def __init__(self, qualifier=None):
        self._event_queue = collections.deque()

        # Set to True when the main loop is actively processing the input
        # queue or has been scheduled to do so.  Set to False when the loop
        # runs out of work and switches to the Hub to wait for more.
        self._scheduled = True
        # (Monotonic time) timestamp of last schedule.
        self._last_scheduled = None
        # Cache the gevent Hub and main loop.
        self._gevent_hub = gevent.get_hub()
        self._gevent_loop = self._gevent_hub.loop

        self.greenlet = gevent.Greenlet(self._loop)
        self._op_count = 0
        self._current_msg = None
        self.started = False

        # Message being processed; purely for logging.
        self.msg_id = None

        # Logging parameters
        self.qualifier = qualifier
        if qualifier:
            self.name = "%s(%s)" % (self.__class__.__name__, qualifier)
        else:
            self.name = self.__class__.__name__
        # Can't use str(self) yet, it might not be ready until subclass
        # constructed.
        _log.info("%s created.", self.name)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号