将线程对象添加到优先级队列

时间:2019-05-14 21:33:35

标签: multithreading python-2.7 priority-queue python-2.6

我有一个场景,其中有3个任务。 A,B,C A没有依赖关系。 B依赖于A。C没有依赖关系。我需要并行运行任务A和C,然后在A完成后再运行任务B。我认为带有线程的优先级队列是最好的方法。请建议

 for task in listTasks:
    if not len(depDic [task]):
       th = threadObject()
       th.start() 
    else:
       '''trying to figure out this logic'''

listTasks= ['A','B','C']
depDic = { 'A' :[], 'B':[A], 'C': '']

0 个答案:

没有答案
相关问题