[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Re: Idea for making threads easier
From: Roberto Alsina <ralsina () unl ! edu ! ar>
Date: 2000-03-07 12:28:40
[Download RAW message or body]
On Tue, 7 Mar 2000, Rik Hemsley wrote:
> The QpThread library (not related to Qt) provides a pthread wrapper
> with an API similar to that of Java.
>
> Here's an example of how you write a 'thread' with QpThread:
>
> class MyThread : public QpThread
> {
> public:
> MyThread() : QpThread() { }
> ~MyThread() { Join(); }
> void Main() { /* Do some work */ }
> };
>
> This could give us a great way of handling threads in KDE apps.
>
> e.g.
>
> Pixie::ThumbView::refresh()
> {
> ThumbGenerator t(this);
> t.Start();
> }
>
> Problem: Qt gets very upset if you aren't careful to separate your
> code. The above example simply crashes Qt. You have to
> remove all Qt-related code from your thread and communicate
> over pipes.
>
> Solution: Adapt QpThread to use the pthread emulation of Pth.
>
> I've managed to _compile_ QpThread for Pth.
>
> This involved adding a few #defines to avoid including certain system
> headers, something which is advised by Pth.
>
> The way I've done it is just a quick hack, so someone who knows more
> could do it cleanly.
>
> Most of the QpThread examples seem to run OK but my limited knowledge
> w.r.t. threading issues in general prevents me getting much further
> on my own.
>
> I *think* Qt would perhaps have to be linked to Pth's version of
> libpthread and compiled with thread support, otherwise it would
> block in select... but I'm just guessing.
Well, you can do the QMTApplication thing I explained in my Qt/Pth howto
:-)
> Any thoughts ?
It looks cool. I am not familiar with QpThread, but I will take a look as
soon as possible!
("\''/").__..-''"`-. . Roberto Alsina
`9_ 9 ) `-. ( ).`-._.`) ralsina@unl.edu.ar
(_Y_.)' ._ ) `._`. " -.-' Centro de Telematica
_..`-'_..-_/ /-'_.' Universidad Nacional del Litoral
(l)-'' ((i).' ((!.' Santa Fe - Argentina
KDE Developer (MFCH)
The stone age didn't end for a lack of stone" Firoz Rasul
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic