有个 semaphore 的锁机制你可以研究一下。。
smp = Semaphore(3)
def start_process(i):
while True:
try:
smp.acquire()
start_exe(i)
finally:
smp.release()
for i in range(10):
threading.Thread(start_process, (i, )).start()
获取锁的顺序我记得是随机的。
【 在 justmj 的大作中提到: 】
: win10系统,用python调度其他程序执行和输入参数(exe)
: 我有10个程序, 分别是exe1,exe2,exe3...exe10。
: 我希望同一时间,有任意3个exe程序在运行。
: ...................
--
修改:hgoldfish FROM 120.33.11.*
FROM 120.33.11.*