title: Is it useless to use the Lock() in multiprocess Pool()?
body: <p>In my python3 multiprocess program, I need a global variable <code>COUNT</code> for counting. I use the Manager.Lock() to maintain global variable <code>COUNT</code> to prevent conflicts when child-processes write this variable.<br>
  Following is my code implementation;</p>
  
  <pre><code># Ubuntu 16.04 LTS, python 3.6
  from multiprocessing import Pool, Lock, Manager
  COUNT = 0
  def f(lock,x):
      global COUNT
      with lock:
          COUNT += x
          print(COUNT,end=' ')
  
  if __name__ == '__main__':
      manager = Manager()
      lock = manager.Lock()
      print('Origin COUNT:',COUNT)
      print('COUNT in child-process:',end=' ')
      with Pool(4) as pool:
          for i in [2,4,6,8,10]:
              pool.apply(func=f,args=(lock,i))
          pool.close()
          pool.join()
          print()
          print('Final COUNT:',COUNT)
  
  # result
  Origin COUNT: 0
  COUNT in child-process: 6 4 8 2 12 
  Final COUNT: 0
  </code></pre>
  
  <p>It is clear that:</p>
  
  <ol>
  <li>child processes operate on the same variable <code>COUNT</code>.   </li>
  <li>the operation on global variables <code>COUNT</code> by each child process is <strong>Not all saved</strong>.(WHY?)    </li>
  </ol>
  
  <p>Final COUNT is 0??? Shouldn't the result be 30? (<code>sum([2,4,6,8,10])</code>)<br>
  This really confuses me. Lock() failed? </p>