def consume(self): while True: lock.acquire() if not self.b.isEmpty(): print("Consumer consumed", self.b.pop()) #time.sleep(random.random()) lock.release()
def produce(self): while True: lock.acquire() if not self.b.isFull(): self.b.push(randint(1,100)) print ("Producer produced") #time.sleep(random.random()) lock.release()
def produce(self): while True: lock.acquire() if not self.b.isFull(): self.b.addElement(randint(1, 100000)) lock.release()
def consume(self): while True: lock.acquire() if not self.b.isEmpty(): print(self.b.getNextElement()) lock.release()