Limit function execution with timeout using concurrent.futures

后端 未结 0 1704
野性不改
野性不改 2021-02-02 02:02

In code:

import concurrent.futures
import time


def f():
    time.sleep(5)


ids = [1, 2]

with concurrent.futures.ThreadPoolExecutor(max_workers=len(ids)) as ex         


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题