If an exchange has no messages, a task attempting to receive a message will be suspended on the exchange and enter the WAIT state. The next-highest priority task will then run. If this task is of higher priority than the current task, which could be any task at this time, it will run. Messages may pile up at exchanges during periods of peak activity. This situation is not a problem.
Semaphores operate in a similar manner, except that no messages are involved.
A task may wait at a semaphore. Another task may signal the semaphore causing the waiting task to resume. Semaphores provide a means for one task to jog another. Tasking in Practice So much for theory. It's pretty straightforward.