Use the Queue module to create a queue containing a list of jobs. The Queue class maintains a list of objects with put(obj) to add an item to the queue and get() to return an item. The class will take care of the locking necessary to ensure that each job is handed out exactly once.

Here’s a trivial example: