 |
|
 |
|
Threading on Unix
Author: Alec Flett <alecf@netscape.com>
Thanks to Wan-Teh Chang for much of this information
Last updated: Sat Feb 20 03:24:06 PST 1999
This document should clarify general confusion about different threading
APIs/implementation in Mozilla and 3rd party libraries like glib/gtk.
Definitions
Native threads
A thread implementation that is supported by a unix kernel. For example,
Linux's native threads are created with the clone() system call without
the COPYVM flag set.
Threading Library
A user-space library and API that provides user-level access to native
or user level threads. For example, pthreads (also known as Posix Threads)
is the most popular threading library.
Some Unix flavors (Solaris and UnixWare) also have an older API to their
native threads. This API is called Unix International (UI) threads, and
uses the thr_ prefix.
Operating System Specifics
Solaris
-
The UI threads API is commonly referred to as Solaris threads.
-
The Solaris (thr_) threadsAPI and pthreads API are just two different APIs
to the same underlying native thread implementation, so they are fully
compatible.
Linux
-
You can't mix NSPR's user-level threads with the native pthreads.
These two thread implementations are not compatible. You have to
use the pthreads version of NSPR.
Threading Combinations
Mozilla, glib, and NSPR all do their own thread wrangling, so they must
use compatible ways of interacting with threads.
There are only a few ways of building all the libraries so that they
are compatible:
-
pthreads
-
glib: configure --with-threads=posix
-
nspr: gmake MOZILLA_CLIENT=1 USE_PTHREADS=1
-
mozilla: configure --with-pthreads
-
NSPR user-level threads
-
glib: configure --with-threads=none
-
nspr: gmake MOZILLA_CLIENT=1 (MOZILLA_CLIENT=1 makes user-level
threads the default)
-
mozilla: configure (default is to use user-level threads)
|
|
 |