Problem is that the program executes without error, printing the final 'End', but without running the method.
import multiprocessing, time
class Process(multiprocessing.Process):
def __init__(self, id):
super(Process, self).__init__()
self.id = id
def run(self):
time.sleep(1)
print("I'm the process with id: {}".format(self.id))
if __name__ == '__main__':
p = Process(0)
p.start()
p.join()
print("End")
I have tried to simplify the program to the minimum, with the same result. The simplified version:
import multiprocessing, time
def ru(x):
time.sleep(1)
print("I'm the process with id: {}".format(x))
if __name__ == '__main__':
p = multiprocessing.Process(target = ru, args = (0, ))
p.start()
p.join()
print("End")
Input are most welcome.
This post has been edited by DK3250: 17 August 2014 - 08:46 AM

New Topic/Question
Reply



MultiQuote


|