title: What's the right pattern for waiting on a file lock to be released?
body: <p>I need to open a file but if it's currently not available I need to wait until it's ready. What's the best approach to take?</p>
  
  <p><strong>SCENARIO</strong></p>
  
  <p>I'm using files as a persistent caching mechanism for application data. This data needs to be read and deserialized often (written only once, and deleted occasionally). I have a cleanup process that runs on a separate thread that determines which files are no longer needed and deletes them. Opening and reading of files may happen concurrently (rarely, but could happen) and I want the process to wait and try to read the data again.</p>
  
  <p>Thanks!</p>