[英]How to pause main thread untill finishes the execution of set of parallel threads?
First of all I am new to the python multithreading. 首先,我是python多线程的新手。 I have a program that detect hands of set of photos using multiple parallel threads and after detecting main program do some functions based on that hand detected images. 我有一个程序,使用多个并行线程检测一组照片的手,并在检测到主程序后,根据手检测到的图像执行一些功能。 functions are on main thread. 函数在主线程上。 But now both functions and hand detection threads are running parallel. 但现在功能和手检测线程都是并行运行的。 I need to pause main thread until finishes the execution of hand detection threads.Sorry for my language mistakes. 我需要暂停主线程直到完成手检测线程的执行。我的语言错误。
#Thread creation function
def callThreads(self, imageLst):
global taskLock, tasks
for tid in range(1, 10, 1): ## 1,11,1
thread = handdetect.detectHandThread(imageLst, tid, 'thread_{}'.format(tid), tasks, taskLock,
obj_detection_graph_queue, obj_detLock)
thread.start()
threads.append(thread)
print("[INFO] Thread {} created and added to the pool...".format(tid))
# main() function of the programme
..............
self.callThreads(filenames)
Some functions()
............
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.