title: Python: multiprocessing - terminate other processes after one process finished
body: <p>I have some programm in which multiple processes try to finish some function. My aim now is to stop all the other processes after one process has successfully finished the function.</p>
  <p>The python program shown below unfortunately waits until all the processes successfully solved the question given in find function. How can I fix my problem?</p>
  <pre><code>import multiprocessing
  import random
  
  FIND = 50
  MAX_COUNT = 100000
  INTERVAL = range(10)
  
  def find(process, initial, return_dict):
      succ = False
      while succ == False:
          start=initial
          while(start &lt;= MAX_COUNT):
              if(FIND == start):
                  return_dict[process] = f&quot;Found: {process}, start: {initial}&quot;
                  succ = True
                  break;
              i = random.choice(INTERVAL)
              start = start + i
              print(start)
  
  processes = []
  manager = multiprocessing.Manager()
  return_code = manager.dict()
  for i in range(5):
      process = multiprocessing.Process(target=find, args=(f'computer_{i}', i, return_code))
      processes.append(process)
      process.start()
  
  for process in processes:
      process.join()
  
  
  print(return_code.values())
  </code></pre>
  <p>output can be for example:</p>
  <pre><code>['Found: computer_0, start: 0', 'Found: computer_4, start: 4', 'Found: computer_2, start: 2', 'Found: computer_1, start: 1', 'Found: computer_3, start: 3']
  </code></pre>
  <p>But this output shows me the program is waiting until all processes are finished ...</p>