[Qt-interest] query on QCoreApplication:exec()

Prasanta Sadhukhan Prasanta.Sadhukhan at Sun.COM
Tue Dec 2 10:06:26 CET 2008


Hi,

 From http://doc.trolltech.com/4.4/threads.html, I found that
/Note that QCoreApplication::exec 
<http://doc.trolltech.com/4.4/qcoreapplication.html#exec>() must always 
be called from the main thread (the thread that executes main()), not 
from a QThread <http://doc.trolltech.com/4.4/qthread.html>. In GUI 
applications, the main thread is also called the GUI thread because it's 
the only thread that is allowed to perform GUI-related operations.

/but in the attached application, I tried creating a linux thread from 
main and tries to call exec from the spawned thread and exec works.
I guess as per above line, exec() should only be calling from thread 
running main() and not from the spawned thread, am I right?
My question is is any thread a main thread so long it's not spawned by 
QThread api?

Regards
Prasanta
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20081202/58658967/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: drawline.cpp
Type: text/x-c++src
Size: 6109 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20081202/58658967/attachment.bin 


More information about the Qt-interest-old mailing list