[webkit-qt] multithread in QtWebKit

sarvesh saran aquarian.thunder at gmail.com
Mon Mar 21 23:35:41 PDT 2011


2011/3/22 周鹏 <zhoupeng19 at 126.com>

> 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>

>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-qt/attachments/20110322/0fdb910b/attachment.html>


More information about the webkit-qt mailing list