是否可以在python中同时连续运行2个线程?

问题描述 投票:0回答:1

我尝试运行正在计算不同数据的线程,并且在进行服务器调用以提供数据时。

我不明白的是为什么程序在线程启动后为什么不传递给调用发送和接收?>

class FuncThread(threading.Thread):
  def __init__(self, image_model):  
    self.image_model = image_model
    threading.Thread.__init__(self)

  def run(self):
    image_model = self.image_model
    while True:

def sending_ receiving(): 
  while true: 

image_model = init()
thread1 = FuncThread(image_model)  
thread1.setDaemon(True)
thread1.start() # this should not affect the course of executing order 
sending_and_reciveing()   - this is contiuously listening client request

thread.start正在调用run方法,该方法是持续运行的while true循环。

我尝试运行正在计算不同数据的线程,并且在进行服务器调用以提供数据时。我不明白的是为什么程序在...

python python-3.x multithreading python-multithreading
1个回答
0
投票

如果我纠正了您代码中的错别字,则在我的机器上可以正常使用。

© www.soinside.com 2019 - 2024. All rights reserved.