Subj : Re: Challenge: Multithreading & Synchronization To : comp.programming.threads From : Maciej Sobczak Date : Thu May 19 2005 10:45 am Hi, Uenal Mutlu wrote: > BTW, as can been this solution also has a simple and effient method to > make any class with a standard constructor (incl. STL classes) thread safe. Depends on what you mean by "thread safe". What you need is synchronized *collaboration* between objects. Usually *many* objects, of possibly different types. Adding a mutex to every value is in general operating on the wrong level of granularity. It is neither simple (you limit yourself to use only the default constructor of the given class) nor efficient (you have to lock a lot of mutexes to achieve any non-trivial collaboration between separate objects). > It's done like this: > > Lockable > myvec; mutex mtx; vector vec; -- Maciej Sobczak : http://www.msobczak.com/ Programming : http://www.msobczak.com/prog/ .