美文网首页
event异步回调

event异步回调

作者: jacke121 | 来源:发表于2017-09-24 11:39 被阅读2次

    importthreading

    importtime

    defdo(event):

    print('start')

    time.sleep(1)

    event.set()

    print('event set')

    event_obj = threading.Event()

    t = threading.Thread(target=do,args=(event_obj,))

    t.start()

    print("no event result")

    event_obj.wait()

    # for i in range(10):

    print("event result")

    相关文章

      网友评论

          本文标题:event异步回调

          本文链接:https://www.haomeiwen.com/subject/oxdkextx.html