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

List:       kde-devel
Subject:    Re: Threading in KDE-programs
From:       Stefan Westerfeld <stefan () space ! twc ! de>
Date:       2000-05-19 0:02:27
[Download RAW message or body]

   Hi!

On Thu, May 18, 2000 at 08:54:37PM +0200, Kris Gijbels wrote:
> Question from a beginning KDE programmer :)
> 
> I've never written programs with a GUI before. I've been trying out Java+Swing a
> bit, but after finding out that this tends to eat huge amounts of memory, I
> decided to try out KDE.
> 
> My question: in Java you  use subclasses of class
> Thread to make well, threads. How do I do this with Qt/KDE? I have a book on Qt
> but it doesn't seem to mention this. And I can't find anything about it on the
> kde development documentation page. Is there something similar in KDE, or do I
> just use fork or the pthread-library or whatever? :)

If you have used Java before, you are probably used to thinking in threads. In
Java, you do everything by using threads. The language allows you to do so
easily, and often even forces you. For instance, as far as I know the usual
way in Java if you have a network connection (or more than one), is not to
get notified when you should read or write something, but to create a thread
for every connection.

Programming C++ with Qt is much different. Look at the source of almost any
KDE application - you will not find a thread. This is because C++ much less
actively supports threading, and since Unix, X11 and Qt programming are not
thought to be done with threads, you are almost every time better off without.

Using threads is not something should do in your very first KDE program unless
you have really good reasons to do so.

   Cu... Stefan
-- 
  -* Stefan Westerfeld, stefan@space.twc.de (PGP!), Hamburg/Germany
     KDE Developer, project infos at http://space.twc.de/~stefan/kde *-         

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

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