We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 17d5f42 commit eb4acbcCopy full SHA for eb4acbc
1 file changed
Chapter03/stopThr01.py
@@ -3,7 +3,6 @@
3
import threading
4
import time
5
6
-
7
class TestThread(threading.Thread):
8
def __init__(self):
9
threading.Thread.__init__(self)
@@ -15,8 +14,9 @@ def terminate(self):
15
14
16
def run(self):
17
count = 1
+ thredName = threading.current_thread().getName()
18
while self._running:
19
- print("threadName={0},count={1}".format(threading.current_thread().getName(),count))
+ print("threadName={0},count={1}".format(thredName,count))
20
count = count + 1
21
time.sleep(1) # 暂停一秒钟
22
0 commit comments