title: Multi-threading: Signal vs BusyWait(Polling), Inter-thread condition variables questions
body: <p>I have a general Question about inter-thread communication.</p>
  
  <p>Right now I am using a bunch of C++ thread (~15).</p>
  
  <p>They are all using BusyWait(Polling) each others to get data to process. But it is hard to keep cpu usage low &amp;&amp; give good performance and avoiding doing too many context switch.</p>
  
  <p>So I am looking at Condition variable, and signal. I think I understand the general concept of having on thread going into .Wait(), waiting for another thread calling .Signal().</p>
  
  <p>Question #1) My problem might be conceptual, but if the thread waiting for a signal get SUSPENDED while waiting, it is not able to perform any action, by its own. Is there anyway to let it wake up by itself to perform some actions.</p>
  
  <p>Question #2) In addition my class are use to pass data in both directions. But if the middle class is waiting for signal from another class, it is unable to send signal to that class. Such as:</p>
  
  <pre><code> _________                       _________                       __________
  | Class A |---newData Signal---&gt;| Class B |---newData Signal---&gt;| Class C  |
  |         |                     |(WAITING)|&lt;---newData Signal---|          |
   ---------                       ---------                       ----------
  </code></pre>
  
  <p>So if Class B is on .Wait() for .Signal() from C, it is unable to process the new signal from A.</p>
  
  <p>Is it possible that both A &amp;&amp; C send the same "newData" signal B to wake it up? Would it be possible to differenciate the signal from A &amp;&amp; C.</p>
  
  <p>I am coding this using C++ using ACE framework &amp; might switch to Boost. But I guess this is generic enough that I could apply the answer to any OS (hopefully).</p>
  
  <p>Thanks</p>