Use a queue for synchronization.

Rather than a busy wait loop.