title: Python filelock module behavior using `with:` statement
body: <p>I was just wondering about the specifics of python's module filelock and its behavior in a few circumstances. </p>
  
  <p>First, how exactly is the <code>with:</code> statement handled by threads. If multiple threads call <code>with:</code> is it locked on a thread by thread basis? Is it also possible that two threads could acquire the lock at the same time?</p>
  
  <p>Second, when I use <code>with:</code> do I have to clear the lock after its use? Is the lock automatically cleared after the <code>with:</code> statement is done?</p>
  
  <p>Third, I have an instance in my code where I believe a file must be created then locked immediately. Currently I am using this:</p>
  
  <pre><code>channel_file = open(os.path.join('channels', username), 'w+')
  with filelock.FileLock(os.path.join('channels', username)):
    channel_file.write(json.dumps({'rate': reobj.group(1),'time': reobj.group(2)}))
  </code></pre>
  
  <p>If there were a possibility that another thread could read the file since the time it was created, would this protect against that? </p>
  
  <p>This also brings up a forth point. Does filelock lock read access while using <code>with:</code>?</p>