Ejemplo n.º 1
0
 def consume(self): 
     while True:
        lock.acquire()
        if not self.b.isEmpty():
            print("Consumer consumed", self.b.pop())
            #time.sleep(random.random())
        lock.release()
Ejemplo n.º 2
0
 def consume(self):
     while True:
         lock.acquire()
         if not self.b.isEmpty():
             print("Consumer consumed", self.b.pop())
             #time.sleep(random.random())
         lock.release()
Ejemplo n.º 3
0
 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()
Ejemplo n.º 4
0
 def produce(self):  
     while True:
         lock.acquire()
         if not self.b.isFull():
             self.b.addElement(randint(1, 100000))
         lock.release()
Ejemplo n.º 5
0
 def consume(self): 
     while True:
         lock.acquire()
         if not self.b.isEmpty():
             print(self.b.getNextElement())
         lock.release()