title: Use of threading.Thread.join()
body: <p>I am new to multithreading in python and trying to learn multithreading using threading module. I have made a very simple program of multi threading and i am having trouble understanding the <code>threading.Thread.join</code> method.</p>
  
  <p>Here is the source code of the program I have made</p>
  
  <pre><code>import threading
  
  val = 0
  
  def increment():
     global val 
     print "Inside increment"
     for x in range(100):
         val += 1
     print "val is now {} ".format(val)
  
  thread1 = threading.Thread(target=increment, args=())
  thread2 = threading.Thread(target=increment, args=())
  thread1.start()
  #thread1.join()
  thread2.start()
  #thread2.join() 
  </code></pre>
  
  <p>What difference does it make if I use </p>
  
  <pre><code>thread1.join()
  thread2.join()
  </code></pre>
  
  <p>which I have commented in the above code? I ran both the source codes (one with comments and the one without comments) but the output is the same.</p>