The Mozilla
Organization
At A Glance
Feedback
Get Involved
Newsgroups
License Terms
Newsbot
Developer Docs
Roadmap
Projects
Ports
Module Owners
Hacking
Get the Source
Build It
Testing
Download
Bugzilla
Bug Writing
Tools
View Source
Tree Status
New Checkins
Submit A Bug
FAQ
Search

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
    1. glib: configure --with-threads=posix
    2. nspr: gmake MOZILLA_CLIENT=1 USE_PTHREADS=1
    3. mozilla: configure --with-pthreads
  • NSPR user-level threads
    1. glib: configure --with-threads=none
    2. nspr: gmake MOZILLA_CLIENT=1 (MOZILLA_CLIENT=1 makes user-level threads the default)
    3. mozilla: configure (default is to use user-level threads)
Copyright © 1998-1999 The Mozilla Organization.
Last modified February 20, 1999.