I think the OP wants a QSemaphore that will not allow QSemaphore::release() to increase the number of resources available beyond the initial allocation at construction. It is not possible to adapt QSemaphore for this (it does not remember the original allocation, just the current number) but it should be easy enough to wrap one to enforce this. I am not sure this is useful unless you are trying to cover for poor programming elsewhere. Perhaps the OP will explain further.




Reply With Quote
Bookmarks