Added locking to simple_queue to prevent popping record multiple times.