[英]Manage Multiple Threads in Python
Function gen() generates a string, which is a command to be passed into os.system(). 函数gen()生成一个字符串,该字符串是要传递给os.system()的命令。
I need to start 20 threads at the same time, call gen() for each thread, and run the command gen() gives me in each thread. 我需要同时启动20个线程,为每个线程调用gen(),然后在每个线程中运行gen()给我命令。 (parallel) (平行)
Once a command finishes executing in a thread, I want to call gen() again to generate another command, and run that command in the same thread. 一旦命令在线程中执行完毕,我想再次调用gen()来生成另一个命令,并在同一线程中运行该命令。
I want to to keep doing this until 10 minutes have passed. 我想继续这样做直到10分钟为止。
How do I do this? 我该怎么做呢?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.