getDownloader(): Simplify
This commit is contained in:
		
							parent
							
								
									e87e4a60d6
								
							
						
					
					
						commit
						5a654fd7dd
					
				
					 1 changed files with 2 additions and 4 deletions
				
			
		| 
						 | 
					@ -609,10 +609,8 @@ struct CurlDownloader : public Downloader
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ref<Downloader> getDownloader()
 | 
					ref<Downloader> getDownloader()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    static std::shared_ptr<Downloader> downloader;
 | 
					    static ref<Downloader> downloader = makeDownloader();
 | 
				
			||||||
    static std::once_flag downloaderCreated;
 | 
					    return downloader;
 | 
				
			||||||
    std::call_once(downloaderCreated, [&]() { downloader = makeDownloader(); });
 | 
					 | 
				
			||||||
    return ref<Downloader>(downloader);
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ref<Downloader> makeDownloader()
 | 
					ref<Downloader> makeDownloader()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue