def dispatch(resultfiles): """ Create dispatch semaphore and threads. Join threads and returns dispatch status. """ threads = [] semaphore = threading.BoundedSemaphore(value=Configuration.semaphore) for result in resultfiles: expectfile = os.path.join(Configuration.expecteddir, result) resultfile = os.path.join(Configuration.resultdir, result) t = Dispatcher(result, expectfile, resultfile, result, semaphore) t.start() threads.append(t) for t in threads: t.join() return(Dispatcher.get_pass(), Dispatcher.get_total())