Example #1
0
    def __del__(self):
        import threading

        key = object.__getattribute__(self, '_local__key')

        try:
            # We use the non-locking API since we might already hold the lock
            # (__del__ can be called at any point by the cyclic GC).
            threads = threading._enumerate()
        except:
            # If enumerating the current threads fails, as it seems to do
            # during shutdown, we'll skip cleanup under the assumption
            # that there is nothing to clean up.
            return

        for thread in threads:
            try:
                __dict__ = thread.__dict__
            except AttributeError:
                # Thread is dying, rest in peace.
                continue

            if key in __dict__:
                try:
                    del __dict__[key]
                except KeyError:
                    pass # didn't have anything in this thread
Example #2
0
    def __del__(self):
        import threading

        key = object.__getattribute__(self, '_local__key')

        try:
            # We use the non-locking API since we might already hold the lock
            # (__del__ can be called at any point by the cyclic GC).
            threads = threading._enumerate()
        except:
            # If enumerating the current threads fails, as it seems to do
            # during shutdown, we'll skip cleanup under the assumption
            # that there is nothing to clean up.
            return

        for thread in threads:
            try:
                __dict__ = thread.__dict__
            except AttributeError:
                # Thread is dying, rest in peace.
                continue

            if key in __dict__:
                try:
                    del __dict__[key]
                except KeyError:
                    pass  # didn't have anything in this thread
def heartbeat():
    threadsList = []
    for thread in threading._enumerate():
        threadsList.append(thread.name)

    workingThreads = fnmatch.filter(threadsList, 'Thread-*')

    if len(workingThreads) >= 1:
        return True
    else:
        common.conMsg('bot', 'Bot dropped, trying to reinit')
        return False
    def __del__(self):
        import threading
        key = object.__getattribute__(self, '_local__key')
        try:
            threads = threading._enumerate()
        except:
            return

        for thread in threads:
            try:
                __dict__ = thread.__dict__
            except AttributeError:
                continue

            if key in __dict__:
                try:
                    del __dict__[key]
                except KeyError:
                    pass
Example #5
0
    def __del__(self):
        import threading
        key = object.__getattribute__(self, '_local__key')
        try:
            threads = threading._enumerate()
        except:
            return

        for thread in threads:
            try:
                __dict__ = thread.__dict__
            except AttributeError:
                continue

            if key in __dict__:
                try:
                    del __dict__[key]
                except KeyError:
                    pass
Example #6
0
 def PBScheduledTask(self, match):
     try:
         data, response = self.rc.sndcmd(self.rc.PINFO, 'all')
         if response:
             #self.pcount = int(data[11])
             if self.pcount != int(data[11]):
                 self.pcount = int(data[11])
                 for p in self.players.getAll():
                     if not data.count(p.name):
                         for i in threading._enumerate():
                             if i.name == p.name:
                                 return
                         self.write_to_DB(p)
                         self.players.disconnect(p.name)
         data, response = self.rc.sndcmd(self.rc.SINFO)
         if response:
             self.scores = [int(round(float(data[9]),0)), int(round(float(data[10]),0)), int(round(float(data[11]),0))]
     except Exception, error:
         print 'error in count watch'
         print error
Example #7
0
 def update_event(self, inp=-1):
     self.set_output_val(0, threading._enumerate())
    def run(self):
        ts = []
        for thread in threading._enumerate():
            ts.append(thread.name)

        self.server.logger.info(ts)