码迷,mamicode.com
首页 > 编程语言 > 详细

python-多进程类封装

时间:2017-07-17 16:17:35      阅读:180      评论:0      收藏:0      [点我收藏+]

标签:form   span   time()   python   cloc   log   sel   __init__   clock   

 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-多进程类封装

标签:form   span   time()   python   cloc   log   sel   __init__   clock   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!