title: Allow only one thread to get result
body: <p>I am a bit new in paralell programming and trying to find a solution for a next problem:
  Lets have a simple function:</p>
  
  <pre><code>private void doRefreshData()
  {
    items = getUpdatedData();
  }
  </code></pre>
  
  <p>getUpdatedData() is a really time comsumpting function and return dictionary.
  Problem is, that function doRefreshData() may and will be called from multiple threads at once. I would like to achieve, that only first thread will run function, others just wait for the result. Simple lock() is not good, because other threads will also run getUpdatedData(), even if it is not necessary - they have a work already done by other thread.</p>
  
  <p>So I need something like:</p>
  
  <pre><code>private void doRefreshData()
  {
    if (isAlreadyRunning) {
      waitForResult();
      return;
    }
  }
  
    items = getUpdatedData();
  }
  </code></pre>
  
  <p>I know, there is a workaround, but I am sure, that there is already a solution for this problem (Mutex?,Auto/ManualResetEvent?, SomethingElseWithFancyName?)</p>
  
  <p>Update: After the first thread finished work and others also left, it is necessary to allow new thread to run this function - it is OK to ask for a new, refreshed data, even a few seconds later.</p>