Subj : Re: Challenge: Multithreading & Synchronization To : comp.programming.threads From : Giancarlo Niccolai Date : Sat May 21 2005 02:13 pm Uenal Mutlu wrote: > Is nobody on earth able to solve this simple exercise? Put a mutex lock and unlock in accessors. Create different accessors to read, write, change the vector size. Use the same mutex for each vector. I.e. a method to change a vector element may be: void Vector::change( int i, VDATA d ) { m_mutex.lock(); m_vect[i] = d; m_mutex.unlock(); } This won't work for a REAL server, but 1 thread per client doesn't work either, so who cares. At least, it will work when your server sits on your desktop PC serving some random client. At least, it will solve YOUR set of questions. The problem, however, is that your set of question is wrong. Reformulate the problem and the solution will be easy. Bests, Giancarlo. .