title: How to run the same function in parallel with different arguments?
body: <p>I want to run the same function multiple times, each time with different arguments whilst using multithreading or multiprocessing.  This is my code so far:</p>
  
  <pre><code>import threading
  import time
  
  def infiniteloop1(a):
      while True:
          print(a)
          time.sleep(1)
  
  
  thread1 = threading.Thread(target=infiniteloop1('aaa'))
  thread1.start()
  
  thread2 = threading.Thread(target=infiniteloop1('bbb'))
  thread2.start()
  </code></pre>
  
  <p><strong>Expected output:</strong></p>
  
  <pre><code>aaa
  bbb
  aaa
  bbb
  </code></pre>
  
  <p>I.e. each block of <code>aaa</code> and <code>bbb</code> will be printed at the same time every second.</p>
  
  <p><strong>Actual output:</strong>
  only aaa is printed every second</p>