title: C++ Call A Function After Time or Cancel
body: <p>I'm looking for a simple cross platform way to call a function after a certain amount of time with the option of killing it early.</p>
  
  <p>Similar to how javascript works with <code>time = window.setTimeout("alert('Hello');", 500);</code> and <code>if(time) clearTimeout(time)</code></p>
  
  <p>Is this possible in basic C++ without any additional (non standard) libraries or framework?
  If so can you give me a pointer in the right direction?</p>
  
  <p>--</p>
  
  <p>The reason I am doing this is I have a DB query that takes 3/4 seconds the first few times and display a wait cursor for this, however it looks a little silly/distracting after the query is cached and the cursor blinks to wait and then blinks back to normal!</p>
  
  <p>Thanks for your time!</p>