Quote Originally Posted by erakis View Post
I am relatively novice with Qt and as I read on the QT Reference, the main loop (the code executed in the exec of the QCoreApplication) handle message pump. If I am not using any thread and I am doing a while (bStop) in the main, the QCoreApplication will never have the opportunity to handle any message ?
Yes

Quote Originally Posted by erakis View Post
Thus, how the closing event will be detected ? In addition, if (to handle event) I must called "ProcessEvent", this will slow down the operation of my serial port that are time crucial. Maybe you have a better solution ?
I am mostly asking because I/O is Qt is usually done event driven, e.g. sockets, but also serial port.
So I was wondering if you are sure you'll need a thread and all the things that come with multithreaded programming.

Quote Originally Posted by erakis View Post
What do you mean by "race condition" ?
In multithread programming that refers to access to a shared resource, e.g. memory, by two threads without the necessary synchronization.
Also called a data race.
In your case one thread writing a variable and the other reading it.

Quote Originally Posted by erakis View Post
If the console application would received a "CLOSING" event
This usually means that the Qt installed signal handler exits the main event loop.

Have you tried with a simple program without any thread?
Just a QCoreApplication that execs and print something after the exec call?

Cheers,
_