title: Is using multiple 'while()' loops bad practice?
body: <p>I am writing two applications that work with each other. One is in c++, the other in C#. As there is streaming data involved, I am using, in multiple places, code such as:</p>
  
  <pre><code>while (true)
  {
   //copy streamed data to other places
  
  }
  </code></pre>
  
  <p>I am noticing that these programmes use a lot of cpu, and become slow to respond. Is it bad programming to use this kind of loop? Should I be adding a:</p>
  
  <pre><code>Sleep(5);
  </code></pre>
  
  <p>In each one? Will that help with cpu usage?</p>
  
  <p>Thanks!</p>