title: Make processes output one at a time in python
body: <p>I'm using <code>Pool</code> under <code>multiprocessing</code> to do some stuff. </p>
  
  <pre><code>def my_func(...):
      #Different processes can take different time
      print a, b, c #Value that I calculated above. (includes 2 new-lines)
  </code></pre>
  
  <p>There have been instances where values of a, b, c for a process are not printed together. Is there a way to avoid that? Can anyone explain as to what's happening here and how it can be avoided?</p>
  
  <p>My understanding says that if I remove all newlines in the print and keep only one at the end, it should fix the problem. (Problem is, it's not reproducible every time so I'm still testing stuff). </p>
  
  <p>Is there a way I can take <code>sys.stdout</code> exclusively for a process and then release it while I'm printing stuff to <code>STDOUT</code>?</p>