Python
24 Nov 2009
 
 
 
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
-----------------------------------
#!/usr/bin/python
import threading,time
class BT(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
def run(self):
time.sleep(1)
b = BT()
b.start()
time.sleep(2)
b.start()
-----------------------------------
[root@sapr01-gtpsam client]# python test.py
Traceback (most recent call last):
File "test.py", line 15, in <module>
b.start()
File "/usr/lib64/python2.6/threading.py", line 465, in start
raise RuntimeError("thread already started")
RuntimeError: thread already started
-----------------------------------
Отсюда вопрос, как перезапустить тред ???