[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: threading in kde
From:       Rik Hemsley <rik () kde ! org>
Date:       2001-08-30 20:16:21
[Download RAW message or body]

#if Andrew Sutton
> something similar anyway. i'm actually thinking of something a little more 
> powerful then just a single thread running a single method. that can be a 
> little tedious to write.
> 
> the active object pattern from ACE defines a task as - for the most part an 
> object with a thread, but you can do some pretty cool stuff with it. each 
> task has an internal message queue that you can use to stack tasks together - 
> or at least push msgs in and get something done.

We definitely need something like this.

In a music player I've written using QThread, I have added a nested
class called 'Command' to some QThread-derived classes and then
contained an 'MTQueue' (QQueue with a mutex to protect it).

This allows feeding 'commands' to the object (thread) - the only
problem is that I've had to re-write a lot of stuff for each
class where this is used.

> you can also define methods that have asynchronous results (call this method, 
> block until a result is available later).

Quite handy - KIO::NetAccess does the same thing using hacks with the
event loop.

> i'd written a small version of exactly what you were talking about for the 
> project i'm working on now. then we started using ACE and it all went away. 
> i'd be interested in taking some aspects of ACE and writing them into a 
> smallish threading library, but i don't know alot about kde development, so 
> i'd definitely need a guiding hand. except with the c++ - i've got that down 
> ;)

I'll be happy to help if you need any questions answered.

Rik

 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic