Skip to content

Instantly share code, notes, and snippets.

@lamarmarshall
Created January 17, 2018 02:47
Show Gist options
  • Save lamarmarshall/80f520d070579a851d1d3e711bbf9c34 to your computer and use it in GitHub Desktop.
Save lamarmarshall/80f520d070579a851d1d3e711bbf9c34 to your computer and use it in GitHub Desktop.
python multiprocess run in background
import multiprocessing
from time import sleep
def func():
name = multiprocessing.current_process().name
print("starting of process named: ", name)
sleep(2)
print("exiting process")
if __name__ == '__main__':
procname = multiprocessing.Process(target=func, name="proc 1")
procname.daemon = True
procname.start()
procname.join()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment