def readqueue(self): queue = Queue.Queue() try: f = open('user.queue', 'r') for line in f: queue.queue = deque(eval(line)) except: "" finally: return queue if __name__=="__main__": bullyalgorithm(opt=False) producer = Producer() producer.setDaemon(True) producer.start() consumer = Consumer(producer.queue) consumer.setDaemon(True) consumer.start() acceptor = Acceptor() acceptor.setDaemon(True) acceptor.start() while threading.active_count() > 0: time.sleep(0.1)
def readqueue(self): queue = Queue.Queue() try: f = open('user.queue', 'r') for line in f: queue.queue = deque(eval(line)) except: "" finally: return queue if __name__ == "__main__": bullyalgorithm(opt=False) producer = Producer() producer.setDaemon(True) producer.start() consumer = Consumer(producer.queue) consumer.setDaemon(True) consumer.start() acceptor = Acceptor() acceptor.setDaemon(True) acceptor.start() while threading.active_count() > 0: time.sleep(0.1)