ThreadPool in Python
from concurrent . futures import ThreadPoolExecutor import asyncio import time import threading x = 1 def run_forever1 ( lock ): global x while x < 1000 : print ( f'----start1 acc------ { threading . current_thread (). name } -' ) lock . acquire () print ( f'----start1 acced------ { threading . current_thread (). name } -' ) if x < 1000 : print ( f'----run 1------ { threading . current_thread (). name } -' ) x = x + 1 lock . release () print ( f'----start1 release------ { threading . current_thread (). name } -' ) def run_forever2 ( lock ): global x while x < 1000 : print ( f'----start2 acc------ { threading . current_thread (). name } -' ) lock . acquire () print ( f'----start2 acced------ { threading . current_thread (). name } -' ) if x < 1000 : print ( f'----run 2------ { threading . cur...