首页 > 编程语言 > 详细

python-多进程类封装

时间:2017-07-17 16:12:05      阅读:313      评论:0      收藏:0      [点我收藏+]
 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

 

python-多进程类封装

原文:http://www.cnblogs.com/chengyunshen/p/7195900.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!