Answers for "how to get the process id from python multiprocess"

0

how to get the process id from python multiprocess

from multiprocessing import Process
import sys
import time

def say_hello(name='world'):
    print "Hello, %s" % name
    print 'Starting:', p.name, p.pid
    sys.stdout.flush()
    print 'Exiting :', p.name, p.pid
    sys.stdout.flush()
    time.sleep(20)

p = Process(target=say_hello)
p.start()
Posted by: Guest on January-02-2021

Code answers related to "how to get the process id from python multiprocess"

Python Answers by Framework

Browse Popular Code Answers by Language