- auto set max thread count
This commit is contained in:
Majjcom
2022-02-27 15:12:38 +08:00
parent 50e07068c9
commit 5fb37056aa

View File

@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from multiprocessing import cpu_count
import threading import threading
import binascii import binascii
import struct import struct
@@ -134,13 +135,14 @@ def main():
process = [0, 0, 0] process = [0, 0, 0]
if not os.path.exists('./unlock'): if not os.path.exists('./unlock'):
os.mkdir('./unlock') os.mkdir('./unlock')
maxCount = cpu_count()
while True: while True:
count = 0 count = 0
tmp = None tmp = None
for key in musicFiles: for key in musicFiles:
if musicFiles[key] == 1: if musicFiles[key] == 1:
count += 1 count += 1
if count < 5 and musicFiles[key] == 0: if count < maxCount and musicFiles[key] == 0:
upperPrint('解密中...\t{}'.format(key)) upperPrint('解密中...\t{}'.format(key))
musicFiles[key] = 1 musicFiles[key] = 1
Dumper(key, musicFiles).start() Dumper(key, musicFiles).start()