示例#1
0
    def cleanup(self):
        """Make sure the reactor, threads, etc have been stopped.  Also removes
    the file that indicates we shutdown cleanly."""

        #shutdown Twisted
        if ProgramState.USE_GTK:
            Globals.reactor.stop()
            Globals.reactor.runUntilCurrent()

        #ensure that all threads have closed:
        remainingThreads = threading.enumerate()
        for thread in remainingThreads:
            if threading._MainThread != type(thread):
                log_msg(
                    "Thread has not finished by the end of the program: %s" %
                    (thread), 1)

        #start the update if necessary:
        if Updater.get().APPLY_UPDATE:
            ClientUtil.apply_update()

        #NOTE:  we intentionally leave the log files open so that errors can get written to them...
        log_msg("Thanks for using BitBlinder", 2)
        ErrorReporting.destroy_marker_file()

        #NOTE:  this is here so that threads can finish properly.  I was getting errors from leftover threads without it.
        #However, I'm pretty sure that it was just from the IDE
        time.sleep(0.2)
示例#2
0
  def cleanup(self):
    """Make sure the reactor, threads, etc have been stopped.  Also removes
    the file that indicates we shutdown cleanly."""
    
    #shutdown Twisted
    if ProgramState.USE_GTK:
      Globals.reactor.stop()
      Globals.reactor.runUntilCurrent()
      
    #ensure that all threads have closed:
    remainingThreads = threading.enumerate()
    for thread in remainingThreads:
      if threading._MainThread != type(thread):
        log_msg("Thread has not finished by the end of the program: %s" % (thread), 1)

    #start the update if necessary:
    if Updater.get().APPLY_UPDATE:
      ClientUtil.apply_update()
      
    #NOTE:  we intentionally leave the log files open so that errors can get written to them...
    log_msg("Thanks for using BitBlinder", 2)
    ErrorReporting.destroy_marker_file()
    
    #NOTE:  this is here so that threads can finish properly.  I was getting errors from leftover threads without it.
    #However, I'm pretty sure that it was just from the IDE
    time.sleep(0.2)