<div dir="ltr">The start() method of PySide6.QtCore.QThreadPool should also extract this code that Qt6 has:<br><br><div><pre style="color:rgb(0,0,0);white-space:pre-wrap">void QThreadPool::start(std::function<void()> functionToRun, int priority)
{
    if (!functionToRun)
        return;
    start(QRunnable::create(std::move(functionToRun)), priority);
}</pre></div><div><br></div><div>and, of course</div><div><br></div><div><pre style="color:rgb(0,0,0);white-space:pre-wrap">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;
}</pre></div><div><div><br></div><div>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.</div><pre style="color:rgb(0,0,0);white-space:pre-wrap">void start(std::function<void()> functionToRun, int priority = 0);
bool tryStart(std::function<void()> functionToRun);</pre><div><br></div><div>So extract start() and tryStart(), please. This is so convenient. Not sure why you guys ignore this.</div></div><div><br></div><div>The qthreadpool.cpp source code is here: <a href="https://github.com/qt/qtbase/blob/dev/src/corelib/thread/qthreadpool.cpp">https://github.com/qt/qtbase/blob/dev/src/corelib/thread/qthreadpool.cpp</a></div><div>And the qthreadpool.h header file is here: <a href="https://github.com/qt/qtbase/blob/dev/src/corelib/thread/qthreadpool.h">https://github.com/qt/qtbase/blob/dev/src/corelib/thread/qthreadpool.h</a></div></div>