title: Why does the billiard multiprocessing module require the "if __name__=='__main__'" line?
body: <p>If I have the following code:</p>
  
  <pre><code>def f():
      print 'ok!'
      import sys
      sys.exit()
  
  if __name__=='__main__':
      import billiard
      billiard.forking_enable(0)
      p = billiard.Process( target=f)
      p.start()
      while p.is_alive():
          pass
  </code></pre>
  
  <p>The script behaves as expected, printing "ok!" and ending. But if I omit the <code>if __name__=='__main__':</code> line and de-indent the following lines, my machine (OS X) goes crazy, continually spawning tons of Python processes until I <code>killall Python</code>. Any idea what's going on here?</p>
  
  <p>(To those marking this as a duplicate, note that while the other question asks the purpose of  <code>if __name__=='__main__'</code> generally, I'm specifically asking why failure to use it here causes dramatically unexpected behaviour)</p>