#include "libepc.h" BOOL Acquire1Resource(int, int) ; void Release1Resource(int, int) ; void AcquireResources(int thread, int resources) { int resource, count ; /* This algorithm acquires resources when they */ /* become available, without regard to order. */ count = resource = 0 ; while (count < resources) { if (Acquire1Resource(thread, resource)) count++ ; resource = (resource + 1) % resources ; } } void ReleaseResources(int thread, int resources) { int resource ; for (resource = 0; resource < resources; resource++) { Release1Resource(thread, resource) ; } }