Is it harmful to create 1000s of mutexes?

Working on something where I need to be at least somewhat thread-safe internally. I have one "big" class which houses several smaller objects. Each individual small object needs a mutex. The thing is... there might be hundreds or thousands of small objects.

So my question is:

If I give all these small objects their own mutex, would that be bad for performance? Is there a lot of overhead in creating/destroying mutexes?

An alternative would be to have all the small objects share the mutex of the larger object... which is not ideal.

I haven't been able to find any information directly on point in google.

Thanks.
Not sure if this is helpful or if you already found it: http://stackoverflow.com/a/3652428/1959975
Cool. That thread suggests that having a lot of mutexes is not expensive. That's what I figured but wasn't sure.

Thanks.
Topic archived. No new replies allowed.