Subj : Re: Challenge: Multithreading & Synchronization To : comp.programming.threads From : Uenal Mutlu Date : Sat May 21 2005 03:40 am "David Schwartz" wrote > > "Uenal Mutlu" wrote > > > "David Schwartz" wrote > > >> "Uenal Mutlu" wrote in message > >> > >> > It depends on the situation. > >> > In a time-critical application I usually do the following: > >> > while (!fMyFlag) > >> > MyYield(); // gives up the rest of the time slice, ie. > >> > SwitchToOtherThread > >> > //... > >> > >> And if there is no other thread? > > > > You don't know what's inside in my MyYield(). > > And: if there is no other thread then fMyFlag hardly can be set. > > FYI/Hint: I don't use Sleep(0) > > It is depressing how frequently you prove that you have no idea what > you're talking about while you continue to insist that you are right. So, what exactly do you mean is wrong in my statement above? You are just paraphrasing dumb statements without any content. > Hint: The other thread could be running right now on another CPU, making it > impossible for you to yield to it or switch to it. Doesn't matter, in this case it will come back to the same thread on the same CPU. What else have you expected will happen? David, it was you who made the following wrong statement: > > Atomic operations are atomic with respect to a single processor only, > > that is, code cannot be interrupted or signalled during the operation. They > > have no special SMP or multi-threading semantics. Which proves it is actually you who has no idea. I mean: how can someone claiming knowing these things make such a stupid error? It simply shows you have really no idea. .