Python thread 模块,run_on_thread() 实例源码

我们从Python开源项目中,提取了以下16个代码示例,用于说明如何使用thread.run_on_thread()

项目:pythonVSCode    作者:DonJayamanne    | 项目源码 | 文件源码
def run_on_thread(self, text, cur_frame, execution_id, frame_kind, repr_kind = PYTHON_EVALUATION_RESULT_REPR_KIND_NORMAL):
        self._block_starting_lock.acquire()

        if not self._is_blocked:
            report_execution_error('<expression cannot be evaluated at this time>', execution_id)
        elif not self._is_working:
            self.schedule_work(lambda : self.run_locally(text, cur_frame, execution_id, frame_kind, repr_kind))
        else:
            report_execution_error('<error: previous evaluation has not completed>', execution_id)

        self._block_starting_lock.release()
项目:pythonVSCode    作者:DonJayamanne    | 项目源码 | 文件源码
def command_execute_code(self):
        # execute given text in specified frame
        text = read_string(self.conn)
        tid = read_int(self.conn) # thread id
        fid = read_int(self.conn) # frame id
        eid = read_int(self.conn) # execution id
        frame_kind = read_int(self.conn)
        repr_kind = read_int(self.conn)

        thread, cur_frame = self.get_thread_and_frame(tid, fid, frame_kind)
        if thread is not None and cur_frame is not None:
            thread.run_on_thread(text, cur_frame, eid, frame_kind, repr_kind)
项目:pythonVSCode    作者:DonJayamanne    | 项目源码 | 文件源码
def run_on_thread(self, text, cur_frame, execution_id, frame_kind, repr_kind = PYTHON_EVALUATION_RESULT_REPR_KIND_NORMAL):
        self._block_starting_lock.acquire()

        if not self._is_blocked:
            report_execution_error('<expression cannot be evaluated at this time>', execution_id)
        elif not self._is_working:
            self.schedule_work(lambda : self.run_locally(text, cur_frame, execution_id, frame_kind, repr_kind))
        else:
            report_execution_error('<error: previous evaluation has not completed>', execution_id)

        self._block_starting_lock.release()
项目:pythonVSCode    作者:DonJayamanne    | 项目源码 | 文件源码
def command_execute_code(self):
        # execute given text in specified frame
        text = read_string(self.conn)
        tid = read_int(self.conn) # thread id
        fid = read_int(self.conn) # frame id
        eid = read_int(self.conn) # execution id
        frame_kind = read_int(self.conn)
        repr_kind = read_int(self.conn)

        thread, cur_frame = self.get_thread_and_frame(tid, fid, frame_kind)
        if thread is not None and cur_frame is not None:
            thread.run_on_thread(text, cur_frame, eid, frame_kind, repr_kind)
项目:HomeAutomation    作者:gs2671    | 项目源码 | 文件源码
def run_on_thread(self, text, cur_frame, execution_id, frame_kind, repr_kind = PYTHON_EVALUATION_RESULT_REPR_KIND_NORMAL):
        self._block_starting_lock.acquire()

        if not self._is_blocked:
            report_execution_error('<expression cannot be evaluated at this time>', execution_id)
        elif not self._is_working:
            self.schedule_work(lambda : self.run_locally(text, cur_frame, execution_id, frame_kind, repr_kind))
        else:
            report_execution_error('<error: previous evaluation has not completed>', execution_id)

        self._block_starting_lock.release()
项目:HomeAutomation    作者:gs2671    | 项目源码 | 文件源码
def command_execute_code(self):
        # execute given text in specified frame
        text = read_string(self.conn)
        tid = read_int(self.conn) # thread id
        fid = read_int(self.conn) # frame id
        eid = read_int(self.conn) # execution id
        frame_kind = read_int(self.conn)
        repr_kind = read_int(self.conn)

        thread, cur_frame = self.get_thread_and_frame(tid, fid, frame_kind)
        if thread is not None and cur_frame is not None:
            thread.run_on_thread(text, cur_frame, eid, frame_kind, repr_kind)
项目:AutoDiff    作者:icewall    | 项目源码 | 文件源码
def run_on_thread(self, text, cur_frame, execution_id, frame_kind):
        self._block_starting_lock.acquire()

        if not self._is_blocked:
            report_execution_error('<expression cannot be evaluated at this time>', execution_id)
        elif not self._is_working:
            self.schedule_work(lambda : self.run_locally(text, cur_frame, execution_id, frame_kind))
        else:
            report_execution_error('<error: previous evaluation has not completed>', execution_id)

        self._block_starting_lock.release()
项目:AutoDiff    作者:icewall    | 项目源码 | 文件源码
def command_execute_code(self):
        # execute given text in specified frame
        text = read_string(self.conn)
        tid = read_int(self.conn) # thread id
        fid = read_int(self.conn) # frame id
        eid = read_int(self.conn) # execution id
        frame_kind = read_int(self.conn)

        thread, cur_frame = self.get_thread_and_frame(tid, fid, frame_kind)
        if thread is not None and cur_frame is not None:
            thread.run_on_thread(text, cur_frame, eid, frame_kind)
项目:xidian-sfweb    作者:Gear420    | 项目源码 | 文件源码
def run_on_thread(self, text, cur_frame, execution_id, frame_kind, repr_kind = PYTHON_EVALUATION_RESULT_REPR_KIND_NORMAL):
        self._block_starting_lock.acquire()

        if not self._is_blocked:
            report_execution_error('<expression cannot be evaluated at this time>', execution_id)
        elif not self._is_working:
            self.schedule_work(lambda : self.run_locally(text, cur_frame, execution_id, frame_kind, repr_kind))
        else:
            report_execution_error('<error: previous evaluation has not completed>', execution_id)

        self._block_starting_lock.release()
项目:xidian-sfweb    作者:Gear420    | 项目源码 | 文件源码
def command_execute_code(self):
        # execute given text in specified frame
        text = read_string(self.conn)
        tid = read_int(self.conn) # thread id
        fid = read_int(self.conn) # frame id
        eid = read_int(self.conn) # execution id
        frame_kind = read_int(self.conn)
        repr_kind = read_int(self.conn)

        thread, cur_frame = self.get_thread_and_frame(tid, fid, frame_kind)
        if thread is not None and cur_frame is not None:
            thread.run_on_thread(text, cur_frame, eid, frame_kind, repr_kind)
项目:skojjt    作者:martin-green    | 项目源码 | 文件源码
def run_on_thread(self, text, cur_frame, execution_id, frame_kind, repr_kind = PYTHON_EVALUATION_RESULT_REPR_KIND_NORMAL):
        self._block_starting_lock.acquire()

        if not self._is_blocked:
            report_execution_error('<expression cannot be evaluated at this time>', execution_id)
        elif not self._is_working:
            self.schedule_work(lambda : self.run_locally(text, cur_frame, execution_id, frame_kind, repr_kind))
        else:
            report_execution_error('<error: previous evaluation has not completed>', execution_id)

        self._block_starting_lock.release()
项目:skojjt    作者:martin-green    | 项目源码 | 文件源码
def command_execute_code(self):
        # execute given text in specified frame
        text = read_string(self.conn)
        tid = read_int(self.conn) # thread id
        fid = read_int(self.conn) # frame id
        eid = read_int(self.conn) # execution id
        frame_kind = read_int(self.conn)
        repr_kind = read_int(self.conn)

        thread, cur_frame = self.get_thread_and_frame(tid, fid, frame_kind)
        if thread is not None and cur_frame is not None:
            thread.run_on_thread(text, cur_frame, eid, frame_kind, repr_kind)
项目:DjangoWebProject    作者:wrkettlitz    | 项目源码 | 文件源码
def run_on_thread(self, text, cur_frame, execution_id, frame_kind, repr_kind = PYTHON_EVALUATION_RESULT_REPR_KIND_NORMAL):
        self._block_starting_lock.acquire()

        if not self._is_blocked:
            report_execution_error('<expression cannot be evaluated at this time>', execution_id)
        elif not self._is_working:
            self.schedule_work(lambda : self.run_locally(text, cur_frame, execution_id, frame_kind, repr_kind))
        else:
            report_execution_error('<error: previous evaluation has not completed>', execution_id)

        self._block_starting_lock.release()
项目:DjangoWebProject    作者:wrkettlitz    | 项目源码 | 文件源码
def command_execute_code(self):
        # execute given text in specified frame
        text = read_string(self.conn)
        tid = read_int(self.conn) # thread id
        fid = read_int(self.conn) # frame id
        eid = read_int(self.conn) # execution id
        frame_kind = read_int(self.conn)
        repr_kind = read_int(self.conn)

        thread, cur_frame = self.get_thread_and_frame(tid, fid, frame_kind)
        if thread is not None and cur_frame is not None:
            thread.run_on_thread(text, cur_frame, eid, frame_kind, repr_kind)
项目:ApiRestPythonTest    作者:rvfvazquez    | 项目源码 | 文件源码
def run_on_thread(self, text, cur_frame, execution_id, frame_kind, repr_kind = PYTHON_EVALUATION_RESULT_REPR_KIND_NORMAL):
        self._block_starting_lock.acquire()

        if not self._is_blocked:
            report_execution_error('<expression cannot be evaluated at this time>', execution_id)
        elif not self._is_working:
            self.schedule_work(lambda : self.run_locally(text, cur_frame, execution_id, frame_kind, repr_kind))
        else:
            report_execution_error('<error: previous evaluation has not completed>', execution_id)

        self._block_starting_lock.release()
项目:ApiRestPythonTest    作者:rvfvazquez    | 项目源码 | 文件源码
def command_execute_code(self):
        # execute given text in specified frame
        text = read_string(self.conn)
        tid = read_int(self.conn) # thread id
        fid = read_int(self.conn) # frame id
        eid = read_int(self.conn) # execution id
        frame_kind = read_int(self.conn)
        repr_kind = read_int(self.conn)

        thread, cur_frame = self.get_thread_and_frame(tid, fid, frame_kind)
        if thread is not None and cur_frame is not None:
            thread.run_on_thread(text, cur_frame, eid, frame_kind, repr_kind)