Subj : Re: Challenge: Multithreading & Synchronization To : comp.programming.threads From : Sergei Organov Date : Wed May 18 2005 10:56 pm "Uenal Mutlu" <520001085531-0001@t-online.de> writes: > "Sergei Organov" wrote in message news:d6fqsp$qfb$1@n6.co.ru... > > "Uenal Mutlu" <520001085531-0001@t-online.de> writes: [...] > > I'm afraid it's so broken that it can't be fixed in parts. > > What exactly do you mean is broken? Almost everything. > > If you indeed need something working immediately, create single > > recursive lock and lock/unlock it at entry/exit to every function, > > deliver the application, and then start to re-design your > > application ASAP, where ASAP in fact means "as soon as you actually > > understand where and why it is flawed." > > 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(). > > > What's unclear to you? The aim is to collect multiple solutions to the > > > problem. > > > > You see, for me your challenge sounds like this: "For undisclosed > > purpose I've created this messy broken skeleton and called it > > "real-world synchronization challenge". How do you fix my problem?". > > For me it's unclear what "solutions" you are going to collect then. > > IMHO, the best solution is to throw it away, sorry. > > I don't feel so. I would say it is a well-designed classic real-world example > for shared access to a class from multiple threads. Sorry, I give up. At least in C++ you don't have classes in the running program, so they can't be accessed even from single thread. > How would you have designed or formulated it? Sorry, what "it"? -- Sergei. .