title: Why global var is not incremented when using threads in python?
body: <p>For my code, pytest_status['finished'] variable is incrementing very interesting way. Sometimes i can see '2' or '3' (I expect corrent incrementing for every run_test function call):</p>
  
  <pre><code>test 1/53: success
  test 1/53: success
  test 1/53: success
  test 1/53: success
  test 1/53: success
  test 1/53: success
  test 1/53: success
  test 1/53: success
  test 1/53: success
  test 1/53: success
  test 1/53: success
  test 1/53: success
  test 1/53: success
  test 1/53: success
  test 1/53: success
  test 1/53: success
  test 1/53: success
  test 1/53: success
  test 1/53: success
  test 1/53: success
  test 1/53: success
  test 2/53: success
  test 1/53: success
  test 1/53: success
  </code></pre>
  
  <p>and so on. I specially moved it out of lock, my code:</p>
  
  <pre><code>import subprocess
  from multiprocessing import Pool, Lock
  
  pytest_status = {
      'finished' : 0,
      'total'    : 0
  }
  
  print_lock = Lock()
  
  def run_test(test):
      status = subprocess.call(...)
  
      global pytest_status
      pytest_status['finished'] += 1
  
      print_lock.acquire()
      print 'test ' + str(pytest_status['finished']) + '/' + str(pytest_status['total']) + ': ' + ('success' if status == 0 else 'failure')    
      print_lock.release()
  
  def main():
      params = [...]
  
      global pytest_status    
      pytest_status['total'] = len(params)
  
      print 'will perform ' + str(pytest_status['total']) + ' tests'
  
      pool = Pool(30)
      pool.map(run_test, params)
      pool.close()
      pool.join()
  
  if __name__ == '__main__':
      main()
  </code></pre>