python-多进程类封装

 1  #!/usr/bin/python
 2 import multiprocessing,time
 3 
 4 class ClockProcess(multiprocessing.Process):
 5     def __init__(self,value):
 6         super(ClockProcess,self).__init__()
 7         self.value=value
 8 
 9     def run(self):
10         n=5
11         while n>0:
12             print "the time is {}".format(time.ctime())
13             time.sleep(self.value)
14             n-=1
15 
16 p=ClockProcess(3)
17 p.start()
18 
19 while True:
20     time.sleep(2)
21     print "*"*40
原文地址:https://www.cnblogs.com/chengyunshen/p/7195900.html