title: Wait until boolean value changes it state
body: <p>I have a thread which wait for a boolean value to change like this:</p>
  
  <pre><code>while(!value)
  {
    Thread.sleep(1000)
  }
  // Do some work after change of the value
  </code></pre>
  
  <p>This is not my prefered way to do this, cause of massive CPU consumption.</p>
  
  <p>Is there any way to block the Thread, until the boolean value changes it state?</p>