title: python3: does multiprocessing.Lock() also lock at the thread level?
body: <p>I have recently switched from <code>threading</code> to <code>multiprocessing</code> in my python3 program. This seems to work fine, and the <code>multiprocessing.Lock()</code> call seems to indeed successfully work as it's supposed to within multiple threads of execution that I spawn from within my program.</p>
  
  <p>However, my program itself is invoked from another, higher-order module which runs separate instances of my program via normal Python threads. I have no ability to rewrite the code of that module.</p>
  
  <p>I previously was using <code>threading.Lock()</code> and <code>threading.RLock()</code> to manage shared code in this environment, and I'm wondering if <code>multiprocessing.Lock()</code> will do the same as <code>threading.Lock()</code> or <code>threading.RLock()</code> when it is invoked within separate threads of the same process.</p>
  
  <p>Or will I have to implement some sort of hybrid locking mechanism to make sure my shared resources are all safe within my combination<code>multiprocessing</code>-and-<code>threading</code> environment?</p>
  
  <p>If a hybrid is needed, would the following be sufficient? ...</p>
  
  <pre><code>with multiprocessing.Lock():
      with threading.Lock():  # threading.RLock() in some cases
          # code that I want to protect
  </code></pre>
  
  <p>... or would I have to implement something more sophisticated, perhaps via a new locking context manager that I would have to write?</p>
  
  <p>Thank you in advance.</p>