4#ifndef QWINDOWSTHREADPOOLRUNNER_H
5#define QWINDOWSTHREADPOOLRUNNER_H
7#include <QtCore/qmutex.h>
8#include <QtCore/qrunnable.h>
9#include <QtCore/qthreadpool.h>
10#include <QtCore/qwaitcondition.h>
28 template <
class RunnableFunction>
33 : m_mutex(
m), m_condition(
c), m_function(
f) {}
39 m_condition->wakeAll();
46 RunnableFunction m_function;
52 template <
class Function>
57 Runnable<Function> *runnable =
new Runnable<Function>(&m_mutex, &m_condition,
f);
60 const bool ok = m_condition.wait(&m_mutex, timeOutMSecs);
63 pool->cancel(runnable);
74 template <
class Function>
void start(QRunnable *runnable, int priority=0)
Reserves a thread and uses it to run runnable, unless this thread will make the current thread count ...
static QThreadPool * globalInstance()
Returns the global QThreadPool instance.
Runs a task in the global instance of QThreadPool.
bool run(Function f, unsigned long=5000)
QWindowsThreadPoolRunner()
Combined button and popup list for selecting options.