[PySide] Please extract this C++ Qt6 code when compiling PySide6
Keith Kyzivat
keith.kyzivat at qt.io
Fri Sep 3 17:42:20 CEST 2021
Shiboken does not support C++ Templates – that is likely the reason this is not included.
From: PySide <pyside-bounces at qt-project.org> On Behalf Of Boštjan Mejak
Sent: Friday, September 3, 2021 11:38 AM
To: pyside at qt-project.org
Subject: [PySide] Please extract this C++ Qt6 code when compiling PySide6
The start() method of PySide6.QtCore.QThreadPool should also extract this code that Qt6 has:
void QThreadPool::start(std::function<void()> functionToRun, int priority)
{
if (!functionToRun)
return;
start(QRunnable::create(std::move(functionToRun)), priority);
}
and, of course
bool QThreadPool::tryStart(std::function<void()> functionToRun)
{
if (!functionToRun)
return false;
Q_D(QThreadPool);
QMutexLocker locker(&d->mutex);
if (!d->allThreads.isEmpty() && d->activeThreadCount() >= d->maxThreadCount())
return false;
QRunnable *runnable = QRunnable::create(std::move(functionToRun));
if (d->tryStart(runnable))
return true;
delete runnable;
return false;
}
The declarations are there in the C++ header file (qthreadpool.h) for both. I don't understand why isn't this extracted at PySide6 compile time.
void start(std::function<void()> functionToRun, int priority = 0);
bool tryStart(std::function<void()> functionToRun);
So extract start() and tryStart(), please. This is so convenient. Not sure why you guys ignore this.
The qthreadpool.cpp source code is here: https://github.com/qt/qtbase/blob/dev/src/corelib/thread/qthreadpool.cpp
And the qthreadpool.h header file is here: https://github.com/qt/qtbase/blob/dev/src/corelib/thread/qthreadpool.h
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20210903/d5a3eef8/attachment-0001.html>
More information about the PySide
mailing list