上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 22 下一页
摘要: # __author: "ZXYang"# date: 2020/12/23"""max_workers:最多执行任务数(cpu核数 x 5 )submit:线程池中提交任务"""import timefrom concurrent.futures.thread import ThreadPoolE 阅读全文
posted @ 2020-12-23 22:09 zxy_ang 阅读(109) 评论(0) 推荐(0)
摘要: # __author: "ZXYang"# date: 2020/5/21import timeimport geventfrom gevent import monkey;monkey.patch_all()from urllib.request import urlopen"""协程monkey 阅读全文
posted @ 2020-12-23 21:08 zxy_ang 阅读(144) 评论(0) 推荐(0)
摘要: # __author: "ZXYang"# date: 2020/5/21import geventimport timedef f(): print('11', time.ctime()) gevent.sleep(1) # 不能用time.sleep(1), cpu切换可以,此处是单线程不可以。 阅读全文
posted @ 2020-12-23 20:49 zxy_ang 阅读(112) 评论(0) 推荐(0)
摘要: # __author: "ZXYang"# date: 2020/5/21# from greenlet import greenletfrom greenlet import greenletdef f1(): print('11') g2.switch() print('22') g2.swit 阅读全文
posted @ 2020-12-23 20:48 zxy_ang 阅读(95) 评论(0) 推荐(0)
摘要: 以下为复制内容: https://blog.csdn.net/mr__l1u/article/details/81772073 1> 进程、线程和协程的认识: 进程是系统进行资源分配和调度的独立单位; 线程是进程的实体,是CPU调度和分派的基本单位; 协程也是线程,称微线程,自带CPU上下文,是比线 阅读全文
posted @ 2020-12-22 23:22 zxy_ang 阅读(422) 评论(0) 推荐(0)
摘要: # __author: "ZXYang"# date: 2020/12/22"""[[async]]async def: 【异步函数】async with: 【异步上下文】 对象必须符合异步上下文管理器: __aenter__ __aexit__async for: 【异步迭代】 被迭代对象必须要实 阅读全文
posted @ 2020-12-22 23:21 zxy_ang 阅读(104) 评论(0) 推荐(0)
摘要: # __author: "ZXYang"# date: 2020/12/22"""[[async]]async def: 【异步函数】async with: 【异步上下文】 对象必须符合异步上下文管理器: __aenter__ __aexit__async for: 【异步迭代】 被迭代对象必须要实 阅读全文
posted @ 2020-12-22 22:29 zxy_ang 阅读(89) 评论(0) 推荐(0)
摘要: # __author: "ZXYang"# date: 2020/5/20def f(): print('11') count = yield 111111 print(count) print('33') yield 333333r1 = f() # 迭代# next(r1)# next(r1)# 阅读全文
posted @ 2020-12-22 21:13 zxy_ang 阅读(93) 评论(0) 推荐(0)
摘要: # __author: "ZXYang"# date: 2020/5/21import timeimport geventfrom gevent import monkey;monkey.patch_all()from urllib.request import urlopenmonkey.patc 阅读全文
posted @ 2020-12-21 22:22 zxy_ang 阅读(107) 评论(0) 推荐(0)
摘要: # __author: "ZXYang"# date: 2020/5/20def f(): print('11') count = yield 111111 print(count) print('33') yield 333333r1 = f() # 迭代# next(r1)# next(r1)# 阅读全文
posted @ 2020-12-21 22:21 zxy_ang 阅读(78) 评论(0) 推荐(0)
上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 22 下一页