# Start foo as a process p = multiprocessing.Process(target=foo, name="Foo", args=(10,)) p.start() # Wait 10 seconds for foo time.sleep(10) # Terminate foo p.terminate() # Cleanup p.join()
References :
python - Stop code after time period - Stack Overflow
沒有留言:
張貼留言