QThreadPool strange exception

0

I was "messing" with threadpools and I noticed a strange exception. So I'm here to ask you: am i using this object correctly? Or you think it is just a bug or a dummy warning? Here it is. I implemented a basic example with QThreadPool (it's almost the same as the one in the documentation: http://qt-project.org/doc/qt-4.8/thread-basics.html#example-1-using-the-thread-pool).

#include <QCoreApplication>
#include <QTimer>
#include <QRunnable>
#include <QThreadPool>
#include <QDebug>
class Work : public QRunnable
{
public:
    void run()
    {
        qDebug() << "Hello from thread " << QThread::currentThread();
    }
};

int main(int argc, char *argv[])
{
    QCoreApplication app(argc, argv);
    Work work;
    work.setAutoDelete(false);
    QThreadPool *threadPool = QThreadPool::globalInstance();
    threadPool->start(&work);
    qDebug() << "hello from GUI thread " << QThread::currentThread();
    threadPool->waitForDone();
    QTimer::singleShot(3000, &app, SLOT(quit()));
    return app.exec();
}

If i launch the debugger in the status bar where it shows messages such as "Running" and "Debugger finished." it tells me:

Exception at 0x75f6812f, code: 0x406d1388: Startup complete, flags 0x0 (first chance) in KERNELBASE!RaiseException

The program works, because it writes the correct things and do not hang, but that message is strange for me.

Am I doing something wrong?

Thank you

c++
qt
exception
asked on Stack Overflow Jul 17, 2014 by frarugi87

1 Answer

1

It's a first chance exception. It is obviously caught and dealt with by the code, since otherwise your application would have crashed. So it's not a problem.


User contributions licensed under CC BY-SA 3.0