use crossbeam_channel::{Receiver, bounded}; use tokio::time::{Duration, delay_for}; #[tokio::main] async fn main() { let (s, r) = bounded(10); for i i ...
                            
                            
                                分类:
其他好文   时间:
2021-07-19 16:57:38   
                                阅读次数:
0
                             
                         
                    
                        
                            
                            
                                import urllib.request import gevent from gevent import monkey monkey.patch_all() def downloader(img_name, img_url): req = urllib.request.urlopen(img_u ...
                            
                            
                                分类:
编程语言   时间:
2021-06-22 18:01:56   
                                阅读次数:
0
                             
                         
                    
                        
                            
                            
                                在学习python协程的过程中,结合生成器函数,实现了新浪新闻的深度爬取,深度爬取可以一边获得新生成的url,一边向URL发出请求,下面上代码 import aiohttpfrom lxml import etreeimport csvimport asyncioimport osfrom logu ...
                            
                            
                                分类:
其他好文   时间:
2021-06-10 17:45:03   
                                阅读次数:
0
                             
                         
                    
                        
                            
                            
                                # 将请求相关的数据environ封装到Request Context对象中# 再将对象封装到local中(每个线程或协程独立空间存储)# ctx.app --当前app到名称,即Flask对象# ctx.request --Request对象(封装请求相关的东西)# ctx.session --空 ...
                            
                            
                                分类:
其他好文   时间:
2021-06-06 19:30:20   
                                阅读次数:
0
                             
                         
                    
                        
                            
                            
                                Golang协程池的使用 原创 360质量效能 360质量效能 2021-05-28 ...
                            
                            
                                分类:
其他好文   时间:
2021-06-02 14:15:43   
                                阅读次数:
0
                             
                         
                    
                        
                            
                            
                                
                    ####1.官方文档中的解释 针对目前的lua5.4,官方api中对coroutine的解释如下 @class coroutinelib coroutine = {} 创建一个主体函数为 `f` 的新协程。 f 必须是一个 Lua 的函数。 返回这个新协程,它是一个类型为 `"thread"` 的对 ...
                            
                            
                                分类:
其他好文   时间:
2021-06-02 13:24:49   
                                阅读次数:
0
                             
                         
                    
                        
                            
                            
                                
                    不会的点: √进程间同步,进程间通信方式 IO多路复用 epoll select poll √ 协程 死锁 进程和线程的死锁 √ 多线程多进程 √socket怎样建立进程间的通信 √Const关键字的用法 √右值引用 √编程实现:写一下shared_ptr这个类的实现,其中该有的数据成员和函数成员, ...
                            
                            
                                分类:
其他好文   时间:
2021-05-24 03:02:21   
                                阅读次数:
0
                             
                         
                    
                        
                            
                            
                                基于Flask的示例 Server端 from flask import Flask,render_template import time app = Flask(__name__) @app.route('/bobo') def index_bobo(): time.sleep(2) retur ...
                            
                            
                                分类:
其他好文   时间:
2021-05-24 02:55:58   
                                阅读次数:
0
                             
                         
                    
                        
                            
                            
                                import asyncio import time async def say_after(delay, what): """使用 async 声明函数""" await asyncio.sleep(delay) print(what) async def main(): # 一个一个执行 pri ...
                            
                            
                                分类:
编程语言   时间:
2021-05-24 02:55:21   
                                阅读次数:
0
                             
                         
                    
                        
                            
                            
                                
                    多进程 1 #方式一: 2 # from multiprocessing import Process 3 # import time 4 # 5 # def task(name): 6 # print('%s is running' %name) 7 # time.sleep(3) 8 # pri ...
                            
                            
                                分类:
编程语言   时间:
2021-05-04 15:51:14   
                                阅读次数:
0