Subj : Re: Challenge: Multithreading & Synchronization To : comp.programming.threads From : Maciej Sobczak Date : Sat May 21 2005 01:01 am Uenal Mutlu wrote: >>How do you achieve the "wait for something to be done"? >> >>Example: >>One thread moves some elements from one container to another. I want to >>know (in different thread) when it is done. > > I personally do use an atomic flag But I mean - how do you *wait* for it to happen? If you use the flag, then how do you know *when* to check this flag? Do you wait? Or do you just check the flag "from time to time"? > There are many alternatives. The simplest is: > volatile bool gMyFlag = false; > BUT: this method is not recommended. Rightly so - it does not work. -- Maciej Sobczak : http://www.msobczak.com/ Programming : http://www.msobczak.com/prog/ .