11??.py 文件源码

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

项目:Python_Study 作者: thsheep 项目源码 文件源码
def asynchronous():
    # ??????
    from gevent.event import AsyncResult
    # ??????????AsyncRresult?????????????????????
    # ???future?defered???????????????????????????
    a = AsyncResult()

    def setter():
        """
        After 3 seconds set the result of a.
        """
        gevent.sleep(1)
        a.set('Hello!')

    def waiter():
        """
        After 3 seconds the get call will unblock after the setter
        puts a value into the AsyncResult.
        """
        print(a.get())

    gevent.joinall([
                    gevent.spawn(setter),
                    gevent.spawn(waiter),
                    gevent.spawn(waiter)
                    ])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号