[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Multi-Threaded programming in Linux (?)



Shlomi Fish writes:
 > How can I implement a mutli-threaded program in Linux? I'm not talking =
 > about fork() and that kind of stuff because it creates a separate =
 > process. A thread of program accesses the same global variables as the =
 > calling thread. However, I couldn't find beginthread(), endthread() and =
 > etc. on the man pages.

You use pthreads.  There are various implemenations available that
work to varying degrees with different libraries.

Check http://www.globenet.it/~ermmau/Threads/ for general info on
threads under Linux.

Check maybe http://pauillac.inria.fr/~xleroy/linuxthreads/ for info on
the Linux Threads package (kernel based threads).

Check http://www.mit.edu:8001/people/proven/pthreads.html for
Provenzano's user space implementation of pthreads (and man pages for
pthreads).

Check
http://www.sun.com/sunsoft/Products/Developer-products/sig/threads/index.html
for general info on threads.

Note that as far as I know, none of these threads packages
interoperate well with the X libraries.  If you want to use both
threads and X, then you need to recompile the X libraries with
-D_REENTRANT.

If you don't want to recompile X yourself, You can get copies of the X
libraries compiled -D_REENTRANT from the VIBE package.  VIBE is a
product from VISIX.  Java IDE which incorporates the GALAXY class
library.  There's a free beta for linux available from them.  Connect
to http://www.visix.com to get the package.

-- 
Dr. Harvey J. Stein
Berger Financial Research
abel@netvision.net.il


References: