   Thread Inter-Syncronization
  Ok, here is my problem:- A is a Socket Data Receiving Thread- B is processing Data, and Sending it out to a Client- A must signal B that data has arrived- B is allways alive, so geting some sort of signal from A is relatively simple using some sort of Mutex or something- Problem comes when 1) A must know that B has processed its data   and 2) A cannot continue until B as processed its data.  But I do not want to have A busy waiting for B, I would like to finda way to block the A thread, have a blocking wait, instead of a busy wait, where A sits in a loop asking "has B processed the data, can I continue?".Any ideas?   
  Use a semaphore, or implement something like:bool waitBool(bool evaluate){    while (!evaluate)    {   Thread::yield();    }};Where Thread::yield is a function that sleeps the current thread.   ;  queueKuphryn   ;  Ok, but I don't want to have the thread suspended, because then, who would wake it up?And I really didn't want to go into a sleep/check cycle, because that is too granular...Blocking is pretty much what I'm looking for here...   ;  Hi,Are you on a windows system?  If you are, then I would recommend asynchronous I/O or I/O Completion ports... MSDN has good articles on them...If you're not, have a look at the boost thread library.. they have some good synch objects... They have one that is really good that I used to help with the reader/writer problem that you are describing...;Quote:Original post by vetroXLHi,Are you on a windows system?  If you are, then I would recommend asynchronous I/O or I/O Completion ports... MSDN has good articles on them...If you're not, have a look at the boost thread library.. they have some good synch objects... They have one that is really good that I used to help with the reader/writer problem that you are describing...Thanks for the reply.Yes, this is a Windows 2000/XP Project, and also for PDAs (WinCE). I really don't have the time nor the energy to go into boost for this, and any solution I find must work on both platforms...@kuphryn: Could you please elaborate? Where would GDNet be without single-word replies...   ;  Ahh, well then Boost is out of the question if you're on a PDA system... I would recomend looking up Asynchrousouse I/O or I/O Completion ports.. you'll have to decide which one works best for you situation... but they both have built in notification schemes to help with synch issues...I use I/O completion ports if I have to build a large scalable server... but Asycnh I/o is fine if you have less then 64 simultaneous clients (sp) or if you writting a client.   ;Quote:Original post by vetroXLAhh, well then Boost is out of the question if you're on a PDA system... I would recomend looking up Asynchrousouse I/O or I/O Completion ports.. you'll have to decide which one works best for you situation... but they both have built in notification schemes to help with synch issues...I use I/O completion ports if I have to build a large scalable server... but Asycnh I/o is fine if you have less then 64 simultaneous clients (sp) or if you want a client.Nope, not a solution either, I've already built a whole system around this design, so I'm not going to go in another direction at the first sight of trouble, eheh...I just need a way to block A, and have B unblock A.   ;  Well, as you know I've just completed the threaded part of my resource loader, and it uses Boost::Condition for exactly what you want.If you're not willing to use Boost for this, you can always see how they've implemented it. The Boost::Thread library seems pretty small, so it shouldn't be that hard.Other than that, the term you need to search for is 'conditional variable'.   ;  wow! tough customer ;)  Have tried an event based system like this?Lock( DWORD dwTimeWait = INFINITE ){   WaitForSingleObject( m_hLock, dwTimeWait );ResetEvent( m_hLock );}UnLock(){   SetEvent( m_hLock );}   