摘要: from gevent import monkey;monkey.patch_all()import timefrom gevent import spawndef pp(): print('ppstar') time.sleep(2) print('ppover')def oo(): print( 阅读全文
posted @ 2021-02-02 18:27 丑矬穷屌 阅读(80) 评论(0) 推荐(0)
摘要: from threading import Thread,Eventimport timeevent=Event()def wait(): print('wait==') time.sleep(2) print('over!') event.set()def go(i): print(f'{i},Z 阅读全文
posted @ 2021-02-02 18:02 丑矬穷屌 阅读(230) 评论(0) 推荐(0)
摘要: from threading import Thread,Semaphore #类似锁的一个东西import timelock_num=Semaphore(2) #设置锁的数量def test(name): lock_num.acquire() print(f'{name}已加入') time.sl 阅读全文
posted @ 2021-02-02 17:52 丑矬穷屌 阅读(78) 评论(0) 推荐(0)
摘要: from concurrent.futures import ThreadPoolExecutor,ProcessPoolExecutorimport timedef func(i): print('star', i) time.sleep(2) return f'over,{i}'def cb(r 阅读全文
posted @ 2021-02-02 12:27 丑矬穷屌 阅读(87) 评论(0) 推荐(0)