2011/3/22 周鹏 <[email protected]>

> This program is works well,but i want to modify it to multithread,so, i
> have some question:
> 1)When the program is started,the main thread create some child thread,each
> child process one page,and main thread delivery task to child.As far as i
> know,the page process is trigger by QApplication ::exec(),so, if i used
> multithread, every child must have a  QApplication object, i did this in my
> program,but it has "Segmentation fault!" .But if i used a global
> QApplication object,and every child used this object,Does the childs in
> conflict with each other??
>
> From the docs:
For any GUI application using Qt, there is precisely *one* QApplication
object, no matter whether the application has 0, 1, 2 or more windows at any
given time ( the same holds true for threads as well).

You must also realize that there is a difference between a thread and a
child process.

For multi threading, i will recommend you first read this excellent article:
http://developer.qt.nokia.com/wiki/Threads_Events_QObjects

the worker threads can exchange data via signals and slots...if they are
accessing common data structures you will need synchronization primitives
like QMutex, wait conditions etc.

thanks,
Sarvesh
<http://developer.qt.nokia.com/wiki/Threads_Events_QObjects>

>
>
_______________________________________________
webkit-qt mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-qt

Reply via email to