Created
          November 7, 2019 13:00 
        
      - 
      
- 
        Save kovalbogdan95/79c0ee790fa26f0fcd0dc54c6e5af3df to your computer and use it in GitHub Desktop. 
    Python Threading example 
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | from concurrent.futures import ThreadPoolExecutor | |
| from time import sleep | |
| def return_after_5_secs(message): | |
| sleep(5) | |
| return message | |
| pool = ThreadPoolExecutor(3) | |
| future = pool.submit(return_after_5_secs, ("hello")) | |
| print(future.done()) | |
| sleep(5) | |
| print(future.done()) | |
| print(future.result()) | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment