Pause and resume a thread in Qt
-
Hi,
You'll have to be a bit more specific, what exactly do you mean by pausing and resuming a thread ?
-
Then it's up to you to do the design of such a functionality using e.g. a QWaitCondition.
-
Is it possible to do not modify the internal codes of the thread, instead, just operate on the thread itself from outside to suspend and resume the thread.
In Visual C++ and Windows system, it is possible to do so by calling:
pThread->SuspendThread();
and
pThread->ResumeThread();
-
Looks like some answers disappeared… Did you got the last one ?
-
If you are only targeting windows, then you can use native threads directly. Be aware that (AFAIK) posix threads don't have the concept of pause/resume.
-
All my current threads are written via a QThread derived class, need I rewrite all of them to native versions, or is QThread providing an interface for me to access the Windows native thread wrapped by QThread? I think QThread is a wrapper of the underlying operating system native thread.