class SynchronousQueue(object):

    def __init__(self):
        self.ready_to_get = Queue(1)
self.queue = Queue(1)

def get(self):
    self.ready_to_get.put('ready', block=True)
return self.queue.get(block=True)

def put(self, item):
    self.ready_to_get.get(block=True)
self.queue.put(item, block=True)
Good way to build a blocking, zero-length queue in Python