def METHOD_NAME(self):
    while True:
        if self.error:
            break
        self.pendingLock.acquire(True)
        if len(self.pending) == 0:
            self.pendingLock.release()
            break
        task = self.pending.pop(0)
        self.pendingLock.release()
        try:
            task.run()
        except RuntimeError as e:
            if self.error: break
            self.errorLock.acquire(True)
            self.error = True
            self.errorMsg = str(e)
            time.sleep(0.1)
            self.errorLock.release()
            break
    self.runningLock.acquire(True)
    self.running.remove(threading.currentThread())
    self.runningLock.release()