From 7794b77364879b40c9d68038620899b0cd4dbdf9 Mon Sep 17 00:00:00 2001 From: zhanghan2021 Date: Tue, 28 Nov 2023 10:05:54 +0800 Subject: [PATCH] Initialize an instance of the ThreadPool class --- common/threadpool.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 common/threadpool.py diff --git a/common/threadpool.py b/common/threadpool.py new file mode 100644 index 0000000..8a613a9 --- /dev/null +++ b/common/threadpool.py @@ -0,0 +1,16 @@ +# -*- coding:utf-8 -*- +#!/usr/bin/env python +# cython:language_level=3 + +from concurrent.futures import ThreadPoolExecutor +from common.decorator_wrap import DecoratorWrap + +@DecoratorWrap.singleton +class ThreadPool(): + def __init__(self, max_threads = 10): + # Maximum concurrent threads + self.__max_threads = max_threads + self.__thread_obj = ThreadPoolExecutor(self.__max_threads) + # Store the created thread + self.__generate_list = [] + \ No newline at end of file -- Gitee