Subj : Re: Challenge: Multithreading & Synchronization To : comp.programming.threads From : Sergei Organov Date : Thu May 19 2005 02:17 pm "Uenal Mutlu" <520001085531-0001@t-online.de> writes: > "Sergei Organov" wrote > > "Uenal Mutlu" writes: > > > Can you give an example for just the member function f2(), or more if > > > possible? > > > > Sorry, f2() with lock() at the beginning and unlock() at the end? Or > > f2() in a supposed to be a good design? In the former case it's trivial, in > > the latter case I'm afraid there will be no f2(). > > lock(), unlock() applied to what? Applied to the single recursive mutex that protects all the data inside the Server class: class RecursiveMutex; class Server { public: void f2() { mutex.lock(); // uses vMD, vSD mutex.unlock(); } private: RecursiveMutex mutex; std::vector vSD; std::vector vJD; std::vector vMD; }; > Why would you remove f2() since it is a member function, ie. an API > function. 1. Because f2() is not a good name for an API function, obviously. 2. Because the API probably is broken to the same level as the rest of the design. -- Sergei. .