title: How to give outside arguments to a thread (in realtime)?
body: <p><strong>Background</strong></p>
  
  <p>I am trying to code a solution to a problem on <a href="https://raspberrypi.stackexchange.com/q/6981/6609">Raspberry Pi Stackexchange.</a> The person is creating a kiosk, and wants Midori (A browser on Raspbian Wheezy) to reload itself if a network disconnects and then reconnects. To check the internet connectivity, I have decided to  have the program attempt to connect to Google. I use a variable <code>up</code> which is assigned to 0 (down) or 1 (up) depending on the state of the connection. </p>
  
  <p>I am having issues sending the new reassigned <code>up</code> variable to the thread. I am getting a perpetual stream of "Up has not been reassigned" from my thread. </p>
  
  <p><strong>Code</strong></p>
  
  <pre><code>up = -1 #Undefined state
  
  test_net = ("www.google.com", 80)
  
  #Import modules
  import subprocess as sub
  from time import sleep
  import socket
  import threading
  
  def reloader(up):
      print "A new thread is born." #Debug
      while True:
          if up == 1:
              print "The system is up."
          elif up == 0:
              print "The system is down."
              #sub.call(["midori", "-e", "Reload"])
          else:
              print "Up has not been reassigned."
          sleep(5)
  
  
  
  #Check if internet is up
  
  threading.Thread(target = reloader, args = (up,)).start()
  
  while True:
      s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
      try:
          s.connect(test_net)
          up = 1
          print up
      except socket.error:
          up = 0
          print up
      s.close()
      sleep(10)
  </code></pre>