title: What does wait() do on Unix?
body: <p>I was reading about the <code>wait()</code> function in a Unix systems book. The book contains a program which has <code>wait(NULL)</code> in it. I don't understand what that means. In other program there was</p>
  
  <pre><code>while(wait(NULL)&gt;0) 
  </code></pre>
  
  <p>...which also made me scratch my head.</p>
  
  <p>Can anybody explain what the function above is doing?</p>