def do_terminate_threads(whitelist=list()):
 for t in threading.enumerate():
  if (not isinstance(t, TerminatableThread)):
   continue
  if (whitelist and (t not in whitelist)):
   continue
  t.schedule_termination()
  t.stop_and_join()

def do_terminate_threads ( whitelist = list ( ) ) : for t in threading . enumerate ( ) : if ( not isinstance ( t , TerminatableThread ) ) : continue if ( whitelist and ( t not in whitelist ) ) : continue t . schedule_termination ( ) t . stop_and_join ( )
simple function which terminates all of our threads .