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

List:       kde-devel
Subject:    Re: Multithreaded application development
From:       Waldo Bastian <bastian () kde ! org>
Date:       2001-06-17 18:03:30
[Download RAW message or body]

On Sunday 17 June 2001 04:05 am, Christian Gebauer wrote:
> No, Cristian is right, both knode and kdict use pthreads for
> asynchronous network access and data processing. Their design has
> historical reasons - this code was written in pre-KDE2 times.

Ah.. didn't know that.

> I plan to port both programs to kio in the near future. This
> will obsolete pthreads for kdict, but its possible that we keep
> a thread in knode for data processing. We will see...
>
> Anyway, knode is a nice example of what is possible in KDE wrt
> multithreading without using the QThread framework:
>
> * the network threads are strictly non-gui (even kdDebug() is forbidden)
> * in the gui thread we have monitor class which is connected to the
>   network threads via pipes (QSocketNotifier...).
> * the monitor class has a queue of pending jobs. When the network thread
>   is idle, it transfers the data for the first job to the thread and
>   sends a signal to the thread. The thread processes the job and
>   notifies the monitor class when it is done, or it wants to print
>   a progress message, etc. The monitor job extracts the data of the
>   processed job and forwards it to the right GUI class.

Isn't it problematic that Qt isn't compiled with -D_REENTRANT in that case? 
From my understanding that could/would lead to problems once you use system 
calls in your thread since e.g. the non-thread-safe version of errno would be 
used.

Or does it work in this case since Qt will use the non-thread-safe version of 
errno while the thread itself actually uses the thread-safe version of errno, 
thereby keeping the two seperate?

Cheers,
Waldo
-- 
bastian@kde.org | SuSE Labs KDE Developer | bastian@suse.com
 
>> Visit http://master.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