以下线程实现(初学者)有什么问题?

时间:2018-05-23 05:30:03

标签: python multithreading python-3.x

from __future__ import print_function
import os, time, sys, threading, pickle
import _thread
def do_more(selected_site):
  print(selected_site)

def do(threadName, selected_site):
  do_more(selected_site);
  print(f'{threadName} ended');

def main(argv):
  selected_site = "abc.com"
  _thread.start_new_thread( do, ("Thread-1", selected_site ) )
  _thread.start_new_thread( do, ("Thread-2", selected_site ) )

if __name__ == "__main__":
  main(sys.argv[1:])

Thread-1 endedThread-2 ended正在但不是两者,其次do_more()中没有任何内容正在打印

0 个答案:

没有答案