Created
January 17, 2018 02:47
-
-
Save lamarmarshall/80f520d070579a851d1d3e711bbf9c34 to your computer and use it in GitHub Desktop.
python multiprocess run in background
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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