title: Python multiprocessing.Pool does not start right away
body: <p>I want to input text to python and process it in parallel. For that purpose I use <code>multiprocessing.Pool</code>. The problem is that sometime, not always, I have to input text multiple times before anything is processed.</p>
  
  <p>This is a minimal version of my code to reproduce the problem:</p>
  
  <pre class="lang-py prettyprint-override"><code>import multiprocessing as mp
  import time
  
  def do_something(text):
      print('Out: ' + text, flush=True)
      # do some awesome stuff here
  
  if __name__ == '__main__':
      p = None
      while True:
          message = input('In: ')
          if not p:
              p = mp.Pool()
          p.apply_async(do_something, (message,))
  </code></pre>
  
  <p>What happens is that I have to input text multiple times before I get a result, no matter how long I wait after I have inputted something the first time. (As stated above, that does not happen every time.)</p>
  
  <pre><code>python3 test.py
  In: a
  In: a
  In: a
  In: Out: a
  Out: a
  Out: a
  </code></pre>
  
  <p>If I create the pool before the while loop or if I add <code>time.sleep(1)</code> after creating the pool, it seems to work every time. Note: I do not want to create the pool before I get an input.</p>
  
  <p>Has someone an explanation for this behavior?</p>
  
  <p>I'm running Windows 10 with Python 3.4.2
  EDIT: Same behavior with Python 3.5.1</p>
  
  <hr>
  
  <p>EDIT:</p>
  
  <p>An even simpler example with Pool and also ProcessPoolExecutor. I think the problem is the call to <code>input()</code> right after appyling/submitting, which only seems to be a problem the first time appyling/submitting something.</p>
  
  <pre class="lang-py prettyprint-override"><code>import concurrent.futures
  import multiprocessing as mp
  import time
  
  def do_something(text):
      print('Out: ' + text, flush=True)
      # do some awesome stuff here
  
  # ProcessPoolExecutor
  # if __name__ == '__main__':
  #     with concurrent.futures.ProcessPoolExecutor() as executor:
  #         executor.submit(do_something, 'a')
  #         input('In:')
  #         print('done')
  
  # Pool
  if __name__ == '__main__':
      p = mp.Pool()
      p.apply_async(do_something, ('a',))
      input('In:')
      p.close()
      p.join()
      print('done')
  </code></pre>