我正在为我正在从事的项目尝试线程。这是我用作测试的代码
import threading
class one(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
while 1:
print "one"
class two(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
while 1:
print "two"
threads = []
one = one()
two = two()
one.start()
two.start()
threads.append(one)
threads.append(two)
for t in threads:
t.join()
问题是只有第一类运行。你能看出我的代码有问题吗?