I have written a simple Dialog Based application in VC++. I have added one class to it named CMyResource.
There are 8 Instances of my resource and I want to allow only 4 at a time and concurrently . I believe this suggests
use of semaphores. So In my main dialog class
I have created instance of CSemaphore and Used
CSingleLock to point to it. Initial count for semaphore
Have kept to 4 ie
CSemaphore mySemaphore(1,4); and
I have used Afxbegin thread to create threads for all 8
instances But somehow it is not working. All 8 instances
are getting simultaneous access.
I checked the condition by
//Report Access Denied
Can anybody tell me why is it not working ?
Any help appreciated..