__init__.py 文件源码

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

项目:pycos 作者: pgiri 项目源码 文件源码
def send(self, message):
        """May be used with 'yield'. Sends 'message' to task.

        If task is currently waiting with 'receive', it is resumed with
        'message'. Otherwise, 'message' is queued so that next receive call will
        return message.

        Can also be used on remotely running tasks.
        """
        if self._location:
            request = _NetRequest('send', kwargs={'message': message, 'name': self._name,
                                                  'task': self._id},
                                  dst=self._location, timeout=MsgTimeout)
            # request is queued for asynchronous processing
            if _Peer.send_req(request) != 0:
                logger.warning('remote task at %s may not be valid', self._location)
                return -1
            else:
                return 0
        else:
            return self._scheduler._resume(self, message, Pycos._AwaitMsg_)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号