def processInternalCommands(self):
        
        self.acquire()
        try:
            if bufferStdOutToServer:
                self.checkOutput(sys.stdoutBuf, 1) #@UndefinedVariable
                    
            if bufferStdErrToServer:
                self.checkOutput(sys.stderrBuf, 2) #@UndefinedVariable

            currThreadId = GetThreadId(threadingCurrentThread())
            threads = threadingEnumerate()
            foundNonPyDBDaemonThread = False
            foundThreads = {}
            
            for t in threads:
                tId = GetThreadId(t)
                if t.isAlive():
                    foundThreads[tId] = tId
                    
                if not isinstance(t, PyDBDaemonThread):
                    foundNonPyDBDaemonThread = True
                    queue = self.getInternalQueue(GetThreadId(t))
                    cmdsToReadd = []    #some commands must be processed by the thread itself... if that's the case,
                                        #we will re-add the commands to the queue after executing.
                    try:
                        while True:
                            int_cmd = queue.get(False)
                            if int_cmd.canBeExecutedBy(currThreadId):
                                PydevdLog(2, "processing internal command ", str(int_cmd))
                                int_cmd.doIt(self)
                            else:
                                PydevdLog(2, "NOT processing internal command ", str(int_cmd))
                                cmdsToReadd.append(int_cmd)
                                
                    except PydevQueue.Empty:
                        for int_cmd in cmdsToReadd:
                            queue.put(int_cmd)
                        # this is how we exit

            if not foundNonPyDBDaemonThread:
                self.FinishDebuggingSession()
                for t in threads: 
                    if hasattr(t, 'doKill'):
                        t.doKill()
                        
            for tId in self.RUNNING_THREAD_IDS.keys():
                try:
                    if not DictContains(foundThreads, tId):
                        self.processThreadNotAlive(tId)
                except:
                    sys.stderr.write('Error iterating through %s (%s) - %s\n' % (foundThreads, foundThreads.__class__, dir(foundThreads)))
                    raise
                    
        finally:
            self.release()
This function processes internal commands
dataset/ETHPy150Open CountZer0/PipelineConstructionSet/python/common/diagnostic/pydevDebug/pydevd.py/PyDB.processInternalCommands