multithreading - Python threading - Is this what I need? -
    i'm writing python script control various hardware parts of setup. have state want keep while other parts of script thing. think while loop stopping other parts of script running.  need introduce threading that loop can continue run until  tell stop?   not sure if looking @ right method solve issue.   edit:  have pasted of  code whole thing quite large.   this listens usb midi device messages of specific types , performs actions based on input values listed in inst   while true:     b = f.read(1)     s='rawdatab:'+  hex(ord(b))     print s      if b == '\x90':         note=true     elif note:         if b in inst:             print "isnote:"  + str( int(hex(ord(b)), 16))             noteaction(inst.get(b))         note=false      if b== '\xb0':         controller=true      elif controller:     #grab controller byte 1, value byte 2         bcount = bcount +1         cn=hex(ord(b))  #hex value of byte         if bcount == 1:             cntrl=cn ...