我在线程中调用top
进程。你知道吗
如何在其他进程完成后或在一段时间后终止线程和顶层进程?你知道吗
class ExternalProcess(threading.Thread):
def run(self):
os.system("top")
def main():
# run the thread and 'top' process here
# join all other threads
for thread in self.thread_list:
thread.join()
# stop the thread and 'top' process here
使用进程组来处理子进程,这样就可以向子进程发送一个信号kill。你知道吗
导入操作系统 输入信号 导入子流程
如果您使用的是类Unix平台,则可以使用
ps -A
列出您的进程,因此请尝试以下操作:如果您不在unix中,请使用正确的命令来代替
ps -A
相关问题 更多 >
编程相关推荐