2024-09-24 00:24:57 发布
网友
出于安全原因,我需要再次检查子进程是否仍然有效。我是这样产生的:
NdeProc = Process(target=NodeRun, args=(NodeQ,)) NdeProc.start()
我真的只想在“NodeRun”还在运行的情况下检查我的主进程?我还没有在docu中找到任何东西,我想我可能需要做一个时间戳文件,在这个文件中我会不断更新子进程的时间戳,父进程可以检查它,但是我想知道somone是否能想出更好的方法?在
谢谢!在
使用^{}进行此操作:
if NdeProc.is_alive(): ... else: ...
根据文件:
Return whether the process is alive. Roughly, a process object is alive from the moment the start() method returns until the child process terminates.
使用^{} 进行此操作:
根据文件:
相关问题 更多 >
编程相关推荐