Subj : Re: Challenge: Multithreading & Synchronization To : comp.programming.threads From : Sergei Organov Date : Wed May 18 2005 09:13 pm "Uenal Mutlu" <520001085531-0001@t-online.de> writes: > "Sergei Organov" wrote > > "Uenal Mutlu" writes: > > > // non-recursive mutex: > > > class mutex > > > { > > > public: > > > mutex() { /*..*/ } > > > ~mutex() { /*..*/ } > > > void lock() { /*..*/ } > > > void unlock() { /*..*/ } > > > [...] > > > }; > > > > > > // recursive mutex: > > > class rmutex : public mutex > > > { > > > public: > > > rmutex() { /*..*/ } > > > }; > > > > Do you understand that (public) derivation of rmutex from mutex is > > broken OO design in the first place? > > Says who? Me. > Can you also give the exact reason what is wrong? Absence of "is-a" relationship between them. Square and rectangle dilemma revisited. I'm not going to go into more details here as this is an off-topic for this group. > Just imagine a flag set in the ctor of rmutex for enabling rmutex > functionality in mutex. Broken design can't be fixed in implementation. > Everything clear now? Yeah, broken design drives you to broken implementation. > > Anyway, why do you mix OO-issues that you don't seem to understand well, > > C++ issues that you don't seem to understand well, and threads related > > issues that you don't seem to understand well in a single challenge? > > Says who? Give facts, examples, not such nothing-saying empty phrases. It's you who did mix multiple things in your "challenge" most of which are off-topic for this newsgroup and that's unproductive. It shows your inability or unwillingness to clearly and politely describe your primary concern. > The code is for illustration purposes, to describe the problem; it's > just a skelleton, as is written in the text. You shall find your own > solution for the problem. No, I shall not. Anyway, the only problem I see is broken design of your skeleton resulting in the "problem" you challenge others to fix, so the solution is to redesign, but then there will be no "problem". -- Sergei. .