[Qt-interest] Interesting QThread problem
Arnold Krille
arnold at arnoldarts.de
Wed Nov 24 10:01:43 CET 2010
On Tuesday 23 November 2010 23:46:06 Yifei Li wrote:
> Thanks. Is there an alternative to terminate() ?
Keep in mind that terminate will not only stop the threads execution for later
restart/continue, it will really terminate the threads execution the hard way.
Use a variable (probably some bool) to check in your threads execution-loop
and change this variable from the outside. Make the variable volatile so the
compiler doesn't optimize access to that variable.
Maybe you could also use a mutex which the gui locks when the threads should
pause and the thread checks for getting the lock (for a short time, otherwise
you cant lock it from the gui) on each execution-loop.
Have fun,
Arnold
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20101124/274690df/attachment.bin
More information about the Qt-interest-old
mailing list