Qt: Use QThreadPool instead of QThread.

I'm not sure how many Qt worker threads we're going to create at
startup, but using a thread pool is simple enough.

Change-Id: I66c3e1e628f8c38c8e3322e0c01ee5fccda2a98e
Reviewed-on: https://code.wireshark.org/review/24473
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Gerald Combs 2017-11-17 15:13:48 -08:00 committed by Anders Broman
parent a398a9573d
commit c2b9c90367
1 changed files with 4 additions and 4 deletions

View File

@ -97,7 +97,7 @@
#include <QMessageBox>
#include <QMimeDatabase>
#include <QThread>
#include <QThreadPool>
#ifdef _WIN32
# include "caputils/capture-wpcap.h"
@ -143,7 +143,7 @@
// QMimeDatabase can be slow to initialize. Do so in a worker thread
// as early as possible.
// https://github.com/lxde/pcmanfm-qt/issues/415
class MimeDatabaseInitThread : public QThread
class MimeDatabaseInitThread : public QRunnable
{
private:
void run()
@ -395,8 +395,8 @@ int main(int argc, char *qt_argv[])
QTextCodec::setCodecForTr(utf8codec);
#endif
MimeDatabaseInitThread mime_db_init_thread;
mime_db_init_thread.start();
MimeDatabaseInitThread *mime_db_init_thread = new(MimeDatabaseInitThread);
QThreadPool::globalInstance()->start(mime_db_init_thread);
/* Set the C-language locale to the native environment. */
setlocale(LC_ALL, "");