有人能告诉我为什么这个代码吗
import _thread,time
myStop = 0
def myTh():
global myStop
d = 0
for _ in range(10000000):
d += 0
myStop += 1
_thread.start_new_thread(myTh,())
_thread.start_new_thread(myTh,())
_thread.start_new_thread(myTh,())
t = time.time()
while myStop!=3:
# print("hello")
pass
print(time.time() - t)
那要花更多的时间吗
import _thread,time
myStop = 0
def myTh():
global myStop
d = 0
for _ in range(10000000):
d += 0
myStop += 1
_thread.start_new_thread(myTh,())
_thread.start_new_thread(myTh,())
_thread.start_new_thread(myTh,())
t = time.time()
while myStop!=3:
print("hello")
# pass
print(time.time() - t)
我真的很想知道它,因为我在我的项目中坚持这一部分
我试着用表达来代替书面陈述,但运气不好,如果书面陈述不是他们的话,总是需要更多的时间
谢谢
目前没有回答
相关问题 更多 >
编程相关推荐