def get(self):
        "Return the entire queue as a list and clear the queue atomically."
        self.lock.acquire()
        list = self.list
        self.list = []
        self.lock.release()
        return list