summaryrefslogtreecommitdiff
path: root/silx/gui/qt/_utils.py
diff options
context:
space:
mode:
authorAlexandre Marie <alexandre.marie@synchrotron-soleil.fr>2020-07-21 14:45:14 +0200
committerAlexandre Marie <alexandre.marie@synchrotron-soleil.fr>2020-07-21 14:45:14 +0200
commit328032e2317e3ac4859196bbf12bdb71795302fe (patch)
tree8cd13462beab109e3cb53410c42335b6d1e00ee6 /silx/gui/qt/_utils.py
parent33ed2a64c92b0311ae35456c016eb284e426afc2 (diff)
New upstream version 0.13.0+dfsg
Diffstat (limited to 'silx/gui/qt/_utils.py')
-rw-r--r--silx/gui/qt/_utils.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/silx/gui/qt/_utils.py b/silx/gui/qt/_utils.py
index f5915ae..4a7a1c0 100644
--- a/silx/gui/qt/_utils.py
+++ b/silx/gui/qt/_utils.py
@@ -56,12 +56,16 @@ def silxGlobalThreadPool():
""""Manage an own QThreadPool to avoid issue on Qt5 Windows with the
default Qt global thread pool.
+ A thread pool is create in lazy loading. With a maximum of 4 threads.
+ Else `qt.Thread.idealThreadCount()` is used.
+
:rtype: qt.QThreadPool
"""
global __globalThreadPoolInstance
if __globalThreadPoolInstance is None:
tp = _qt.QThreadPool()
- # This pointless command fixes a segfault with PyQt 5.9.1 on Windows
- tp.setMaxThreadCount(tp.maxThreadCount())
+ # Setting maxThreadCount fixes a segfault with PyQt 5.9.1 on Windows
+ maxThreadCount = min(4, tp.maxThreadCount())
+ tp.setMaxThreadCount(maxThreadCount)
__globalThreadPoolInstance = tp
return __globalThreadPoolInstance