Linux and Threads
Mathias Puetz
mpuetz at unm.edu
Fri Dec 10 17:02:01 GMT 1999
On Thu, 09 Dec 1999, you wrote:
>Please excuse me for asking a somewhat non-KDEvelop-targeted question but
>since this list is probably all developers..
>
>I want to create a KDEvelop application that is an internet client. This
>client has to be able to do it's client<->server exchange without tying up
>the GUI (e.g. I want to have an ABORT button on the GUI to stop/abort the
>connection).
>
>What is the best way to do this so it will work with all/most Linux
>distributions?
>
>I was thinking pthreads but, then there's the problem of joining or
>detaching the threads. Does it make sense that I would have at least 2
>threads, not including the main thread? e.g. the main thread to join the 2
>child threads. The 2 child threads accomplish 1) widget management and 2)
>connection management. ?
>
Hmm, if your application is not performance critical a would
not use threads. It's doable the way you mentioned but it's a PITA
to debug. Especially without a (free) debugger on Linux that
supports multi-threading correctly.
Why not write a separate daemon (server) program to perform your tasks
by using fork() for each complex task and communicates with the GUI
program through standard UDP. It's simple, it's far easier to debug,
client and server may reside on different hosts and fast enough for
many purposes.
Mathias
--
______________
/ \
| Mathias Puetz \__________________________________
| \
| Advanced Materials Lab (University of New Mexico) \
| 1001 University SE, Albuquerque, NM 87106 |
| \|/ |
| phone: (505)272-7132 -O- fax: (505)272-7336 |
| /|\ |
| \|/ email: mpuetz at alpha214.unm.edu \|/ |
\___/o\________or puetz at mpip-mainz.mpg.de____/o\____/
More information about the KDevelop
mailing list