User Tools

Site Tools


producer_consumer-problem

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

producer_consumer-problem [2015/12/13 22:59] – created cedricproducer_consumer-problem [2015/12/13 23:28] (current) cedric
Line 43: Line 43:
     for i in range(10):     for i in range(10):
         print("{} make cake {}".format(firstname, i))         print("{} make cake {}".format(firstname, i))
-        await asyncio.sleep(0.5)+        await asyncio.sleep(0.1)
         await q.put(i)         await q.put(i)
  
 async def consume(firstname): async def consume(firstname):
     while True:     while True:
-        = await q.get() +        cake_number = await q.get() 
-        print("{} eat cake {}".format(firstname, i))+        print("{} eat cake {}".format(firstname, cake_number))
  
 if __name__ == "__main__": if __name__ == "__main__":
producer_consumer-problem.txt · Last modified: 2015/12/13 23:28 by cedric