--===============1503434170== Content-Type: multipart/signed; boundary="nextPart3793686.REon5D9uca"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit --nextPart3793686.REon5D9uca Content-Type: text/plain; charset="iso-8859-6" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Tuesday 27 December 2005 21:56, Boudewijn Rempt wrote: > This gives problems with threading: if I start four threads and they > all want to update the progress label, we're in for a rude shock. The > progress label is broken anyway because it uses processEvents(), which > guarantees crashes, especially if users are scaling in one view and > trying to work in another. I'd like to point out a library I wrote that soles this and various other=20 problems. I did that for java swing, but the issues are similar in Qt. What I do is start a queue-thread. This thread holds queue of actions and= =20 hands them to worker threads for execution. Actions (much like KActions) had 2 extra methods in my version; an=20 execute() and a doAction(). The latter being protected (which in Java=20 means that the workerthread can execute it since its in the same=20 package). The execute does nothing but enqueue itself leading it to eventually be=20 processed. This also means that the execute() will return almost=20 immediately. In my action object I did not register one, but 2 slots. The second is=20 optional, and is meant to do UI updating. The second slot is guaranteed=20 to be executed in the normal event thread which means you will never run=20 into threading problems if you do your setProgress and stuf in there. It will only be called ones though, after the primary slot has returned. All the other UI updates (like the progress display label) should IMO=20 simply be wrapped in C++ equivalents of a synchronized(canvasView) { }=20 block, where the canvasView is an object that makes sure only one tread=20 is using the KoView at a time. Hope this makes sense; you can browse the java based solution and its docs= =20 on http://uic.sf.net/index.phtml?target=3Dproduct/Actions/view.phtml Note that that framework has many many features that I really would like=20 to see Qt or KDE have, so you kdelibs hackers, please also take a peek to=20 see what the competition has been doing :) =2D-=20 Thomas Zander --nextPart3793686.REon5D9uca Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQBDsbckCojCW6H2z/QRAs9gAJ4qe15fEi5yvq4fXWmzHB3ZpdUEpwCfcLIn 9MH0RL8KcscVVupiOlw93ZU= =Z343 -----END PGP SIGNATURE----- --nextPart3793686.REon5D9uca-- --===============1503434170== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ kimageshop mailing list kimageshop@kde.org https://mail.kde.org/mailman/listinfo/kimageshop --===============1503434170==--