title: Alternative to spinlock
body: <p>I am using the following spinlock approach:</p>
  
  <pre><code>while(!hasPerformedAction()){
      //wait for the user to perform the action
      //can add timer here too
  }
  
  setHasPerformedAction(false);
  
  return getActionPerfomed();
  </code></pre>
  
  <p>this basically waits for a user to perform an action and then returns it. Currently something requests an answer from the user before continuing, this is why I wait until input is received. However I was wondering if this is inefficient and if we are waiting for a while (i.e. &lt;= 30 secs) will it slow down the pc that is running this app. Are there any other alternatives using this approach i.e. locks, semaphores if so what is the syntax?</p>
  
  <p>Thanks,</p>
  
  <p>Aly</p>