
Why do you need so many mutexes?
Yeah, as a threading non-expert but somewhat educated bystander, what Richard described smells like a design with many locks at object granularity, which is almost always a mistake. Have you considered revisiting the architecture?
--
What is the alternative to placing the mutex at object level? Having some kind of mutex pool?
“at object level” != “object granularity”
By the latter I mean a system where every object has its own mutex, without regard to the invariants *between* objects in the system that must be protected.
--
I re-read the original post and see what you mean: " The problem is that I must support 100,000 objects containg multiple mutexes " ^^^^^^^^ Indeed, that'll lead to more problems than the waste of resources. / Christian