tags:

views:

11

answers:

0

I need to come up with a "ResourceManager" C# class that will create "n" threads (one for HW resource) and hand them to clients so they can use it. Each client is running on a separate thread and will make a blocking call like Resource resource = ResourceManager.GetResource() If there are no available resources after certain timeOut, it'll throw an exception. The caller then will release the resource when it's done.

I am thinking of using an array of Semaphores(size n) controlling an array on Resources[n] and using them to signal whether the resource is available or not, with the client signaling the semaphore when calling the server Release method, but I have the feeling that it's not the simplest design.

Are there any references/resources that have information about resource management on multi-threaded applications?

Thanks in advance