Logic (also called "re-ordering semaphore") issues semaphore grants to access
a shared resource in an order different from the order in which semaphore requests
for accessing the shared resource are received. The re-ordering semaphore needs
to receive a semaphore release between any two semaphore grants. There is no limit
on the duration between a semaphore grant and a semaphore release, so that a task
that receives a semaphore grant can use the shared resource for any length of time.
In one embodiment, each request is associated with a number indicative of the order
in which grants are to be issued, and the re-ordering semaphore uses this number
in deciding which request is to be granted. The number can be a sequence number
that is indicative of the order of arrival of packets that generated the requests.