An extension to a programming language provides for the fair allocation of resources
in the programming language environment. A resource pool data object stores available
resource objects. A resource queue stores users waiting for resource object allocation.
A method releases resources by placing the resources in the resource pool and by
notifying users that a resource object has been released. An acquire resource method
provides for users to be placed on the resource queue when there are no available
resource objects. The acquire resource method waits on the availability of the
resource object until the user comes to the head of the resource queue and a resource
object is available, following which the resource object is returned to the user.
Alternatively, a time out condition is reached once a predefined wait limit is
met. The synchronization between methods and users waiting on resources is provided
by the acquisition and release of a common lock.