[Qt-interest] QObject::moveToThread()

Rainer Wiesenfarth Rainer.Wiesenfarth at inpho.de
Mon Apr 19 15:38:17 CEST 2010


From: Eirik Ulvik
> I am in the process of makin an application multi-threaded. The
> application consists of one thread doing physics calculations and
> another doing graphics.
> 
> My problem is that as the application does not have a 100% clean
> separation between the two threads ie. some OpenGL calls are made from
> the physics thread, the OpenGL context was naturally created from the
> graphics context. Separating these OpenGL calls out and having them in
> the graphics thread is non-trivial and I would like to avoid do this.
> 
> I thought a solution would be to switch processing to the graphics
> thread for the OpenGL calls and switch back when they are done. [...]

Instead of telling you why this will not work the way you would like it to
work, I would like to encourage you to lean back and re-think what are you
trying to achieve, keeping in mind that each thread has its own execution
path.

This is not meant to be offensive, but should bring some enlightenment and
deeper understanding about threading...

(if it does not, please come back to me on this topic, but no earlier than
tomorrow ;-) )

Best Regards / Mit freundlichen Grüßen
Rainer Wiesenfarth

-- 
INPHO GmbH * Smaragdweg 1 * 70174 Stuttgart * Germany
phone: +49 711 2288 10 * fax: +49 711 2288 111 * web: www.inpho.de
place of business: Stuttgart * managing director: Johannes Saile
commercial register: Stuttgart, HRB 9586
Leader in Photogrammetry and Digital Surface Modelling
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 6878 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100419/a7b1b613/attachment.bin 


More information about the Qt-interest-old mailing list