title: How to wait for an event or timeout
body: <p>I'm trying a simple thread program.
  I need to wait for a event and time delay. This time delay is varying. How to do this?</p>
  
  <p>Can anyone explain with a sample program? I know how to spawn a thread with <code>NSThreads</code> as well as through <code>NSInvocationOperation</code>.</p>