Original Post
Hi just wondering if anyone could give me some information about the right way (or a right way) to achieve this please? basically I have a native thread using the windows API calling an update function in my app. a flag is set by the main thread to tell this thread to update. the entry point to the thread looks something like this while(app_not_finished) { if(update_flag) { do stuff; } } and im setting the update flag (and all my other sync variables) between a semaphore aquire and release.... which i think is the equivilent of blocking the thread so the data can be safely modified??? but im a little unsure of the way im handling my entry point, as someone mentioned i should be using the semaphore to sleep / activate the thread instead of having the work carried out in a spin-lock type loop, and im not sure i understand the theory / process of this. would anyone be kind enough to explain what im trying to achieve please? thanks, i hope this isnt too vague