[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Re: threads
From: Roberto Alsina <ralsina () unl ! edu ! ar>
Date: 1999-12-02 11:12:21
[Download RAW message or body]
On Thu, 2 Dec 1999, Lubos Lunak wrote:
> Well, since now there is GNU Pth, we can have threads for all KDE platform. And
> if KDE has to run on all these platforms, we'll have to write the apps as if
> the only underlying Pthreads library was Pth, since Pth is cooperative and
> thus limited compared to let's say LinuxThreads. I mean, code which assumes
> preemptive threads scheduling will block with Pth ( although using threads just
> for better responsive GUI will behave with Pth the same way it would without
> threads - it would just block for a white ).
Well, not all the time if you use one of pth's system call overriding
modes (I don;t think that's actually how they are called), that turns
calls to read() into calls to pth_read() and such.
That way the only real blocks would be in tight loops with no yield()s
inside of them, and those are easy to spot and fix.
> And if will have to assume Pthreads lib is actually Pth, why not use Pth for
> all KDE platforms ? This way facts like Qt not being thread-safe ( btw, when it
> will be finally MT-safe ? ) or X11 libs not being thread-safe are irrelevant -
> they will be ok with Pth. It would probably block more often than with
> LinuxThreads, but this way there would be less problems. Also, since Pth is
> cooperative, writing MT apps would be much easier, debugging would be easier,
> and one would produce less bugs ( or they wouldn't have chance to break anything
> ).
YES. Trying to figure out all race conditions on a "real" multithreading
program is a pain.
For example, you can't have any globals at all, or you are begging for
problems, and, while a little ugly, I find globals amazingly useful :-)
("\''/").__..-''"`-. . Roberto Alsina
`9_ 9 ) `-. ( ).`-._.`) ralsina@unl.edu.ar
(_Y_.)' ._ ) `._`. " -.-' Centro de Telematica
_..`-'_..-_/ /-'_.' Universidad Nacional del Litoral
(l)-'' ((i).' ((!.' Santa Fe - Argentina
KDE Developer (MFCH)
Not mad, but bound more than a madman is (Romeo and Juliet, Act I Scene II)
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic