Subj : Re: Challenge: Multithreading & Synchronization To : comp.programming.threads From : David Schwartz Date : Fri May 20 2005 05:59 pm "Uenal Mutlu" <520001085531-0001@t-online.de> wrote in message news:d6lr37$mph$03$1@news.t-online.com... > "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. 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. DS .