From ef8d18b5e61506b7450f1fb96ca895e704f9de7a Mon Sep 17 00:00:00 2001 From: xuezhixin Date: Mon, 13 Nov 2023 15:23:16 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=9A=E7=BA=BF=E7=A8=8B=E5=AE=8C=E6=88=90AB?= =?UTF-8?q?I=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sysmig_agent/Abisystmcompchk.py | 46 +++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/sysmig_agent/Abisystmcompchk.py b/sysmig_agent/Abisystmcompchk.py index 493c09b..79e6581 100644 --- a/sysmig_agent/Abisystmcompchk.py +++ b/sysmig_agent/Abisystmcompchk.py @@ -919,3 +919,49 @@ def migrate_behind_abi_chk(): i = i + 1 return '0' + + +def MutilThread(nameList, Query, muth_logger): + global exitFlag + + # Default number of cpus + thread_num = int(cpu_count() * 1.5) + + threadList = ["Thread-%d" % (num) for num in range(0, thread_num)] + + threads = [] + threadID = 10 + # threadID = 1 + + fw = open(abi_incomp_chk, 'w') + fr = open(abi_comp_chk, 'w') + + # Creating new thread + for tName in threadList: + thread = myThread(threadID, tName, workQueue, queueLock, fw, fr, Query, muth_logger) + thread.start() + threads.append(thread) + threadID += 1 + + # Fill in the queue + queueLock.acquire() + for word in nameList: + workQueue.put(word) + queueLock.release() + + # Waiting queue clear + while not workQueue.empty(): + pass + + # Notifies the thread that it is time to exit + exitFlag = 1 + + # Wait for all threads to complete + for t in threads: + t.join() + muth_logger.info('========== Exit main thread...... ==========') + + fw.close() + fr.close() + + return True -- 2.20.1