1 Star 0 Fork 110

feiying/anaconda

forked from src-openEuler/anaconda 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-Remove-initThreading-method-from-pyanaconda-threading.patch 2.27 KB
一键复制 编辑 原始数据 按行查看 历史
From 05bda4c50c9df594a6b266ac74b60478da4c532c Mon Sep 17 00:00:00 2001
From: fengtao <fengtao40@huawei.com>
Date: Wed, 12 Feb 2020 15:52:08 +0800
Subject: [PATCH] Remove initThreading method from pyanaconda threading
---
anaconda.py | 5 +----
pyanaconda/threading.py | 17 +----------------
2 files changed, 2 insertions(+), 20 deletions(-)
diff --git a/anaconda.py b/anaconda.py
index 14048e7..52c8826 100755
--- a/anaconda.py
+++ b/anaconda.py
@@ -274,10 +274,7 @@ if __name__ == "__main__":
setup_python_path()
# init threading before Gtk can do anything and before we start using threads
- # initThreading initializes the threadMgr instance, import it afterwards
- from pyanaconda.threading import initThreading, AnacondaThread, threadMgr
- initThreading()
-
+ from pyanaconda.threading import AnacondaThread, threadMgr
from pyanaconda.core.i18n import _
from pyanaconda.addons import collect_addon_paths
diff --git a/pyanaconda/threading.py b/pyanaconda/threading.py
index a86003d..e0ab802 100644
--- a/pyanaconda/threading.py
+++ b/pyanaconda/threading.py
@@ -44,10 +44,6 @@ class ThreadManager(object):
self._objs_lock = threading.RLock()
self._errors = {}
self._errors_lock = threading.RLock()
- self._main_thread = threading.main_thread()
-
- def set_current_thread_as_main(self):
- self._main_thread = threading.current_thread()
def __call__(self):
return self
@@ -176,9 +172,7 @@ class ThreadManager(object):
def in_main_thread(self):
"""Return True if it is run in the main thread."""
-
- cur_thread = threading.current_thread()
- return cur_thread is self._main_thread
+ return threading.current_thread() is threading.main_thread()
@property
def running(self):
@@ -293,13 +287,4 @@ class AnacondaThread(threading.Thread):
self._target_stopped()
-def initThreading():
- """Set up threading for anaconda's use. This method must be called before
- any GTK or threading code is called, or else threads will only run when
- an event is triggered in the GTK main loop. And IT HAS TO BE CALLED IN
- THE MAIN THREAD.
- """
- threadMgr.set_current_thread_as_main()
-
-
threadMgr = ThreadManager()
--
1.8.3.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/OfeiyingO/anaconda.git
git@gitee.com:OfeiyingO/anaconda.git
OfeiyingO
anaconda
anaconda
master

搜索帮助