title: How to keep a process running?
body: <p>I have a process that starts several threads which do some stuff, listen to some ports, etc.</p>
  
  <p>After it starts all threads, the main thread currently goes into an infinite loop:</p>
  
  <p>It's something like:</p>
  
  <pre><code>int main()
  {
     //start threads
     while (true)
     {
        sleep(1000);
     }
  }
  </code></pre>
  
  <p>The extra <code>sleep</code> assures the main thread doesn't eat the processor. </p>
  
  <p>Is this approach ok? Is there an industry standard on how a process is kept alivet? Thanks.</p>
  
  <p>EDIT: Some clarifications:</p>
  
  <ul>
  <li>the threads are listeners, so a <code>join</code> or <code>WaitForSingleObject</code> isn't an option. Usually I could use join here, but the threads are started by a third client library and I don't have any control over them.</li>
  <li>doing some processing in the main thread doesn't make sense from a design point of view.</li>
  </ul>