freebsd-skq/lib
Mike Makonnen 71d09bc86a Start locking up the active and dead threads lists. The active threads
list is protected by a spinlock_t, but the dead list uses a pthread_mutex
because it is necessary to synchronize other threads with the garbage
collector thread. Lock/Unlock macros are used so it's easier to make
changes to the locks in the future.

The 'dead thread list' lock is intended to replace the gc mutex.
This doesn't have any practical ramifications. It simply makes it
clearer what the purpose of the lock is. The gc will use this lock,
instead of the gc mutex, to synchronize access to the dead list with
other threads.

Modify _pthread_exit() to use these two new locks instead of GIANT_LOCK,
and also to properly lock and protect thread state changes,
especially with respect to a joining thread.

The gc thread was also re-arranged to be more organized and less nested.

_pthread_join() was also modified to use the thread list locks. However,
locking and unlocking here needs special care because a thread could find
itself in a position where it's joining an exiting thread that is
waiting on the dead list lock, which this thread (joiner) holds. If the
joiner doesn't take care to lock *and* unlock in the same order they
(the joiner and the joinee) could deadlock against each other.

Approved by:	re/blanket libthr
2003-05-25 08:31:33 +00:00
..
compat Add libgmp.so.3 from 4.7-RELEASE CDs. 2003-02-17 17:26:03 +00:00
csu This is now Gcc 3.3 WARNS 6 clean. 2003-05-04 18:34:00 +00:00
libalias style.Makefile(5) 2003-04-20 18:38:59 +00:00
libatm fix __FBSDID 2003-04-20 18:41:16 +00:00
libbind Removed now unused INTERNALSTATICLIB. 2002-05-13 11:09:07 +00:00
libbz2 Zap now-unused SHLIB_MINOR 2002-09-28 00:25:32 +00:00
libc mdoc(7) fixes. 2003-05-24 19:53:08 +00:00
libc_r mdoc(7) fixes. 2003-05-24 19:53:08 +00:00
libcalendar
libcam english(4) police. 2002-12-27 12:15:40 +00:00
libcom_err
libcompat The .Fn function 2003-03-24 16:02:05 +00:00
libcrypt Retire the useless NOSECURE knob. 2003-05-19 15:52:01 +00:00
libdevinfo Expand length of pnpinfo and length fields since pccard pnpinfo can 2003-02-17 18:56:00 +00:00
libdevstat Assorted mdoc(7) fixes. 2003-05-22 13:02:28 +00:00
libdisk Teach libdisk that AMD64 works just like i386 2003-04-30 21:03:16 +00:00
libedit The .Fn function 2003-02-06 11:25:03 +00:00
libexpat english(4) police. 2002-12-27 12:15:40 +00:00
libfetch Assorted mdoc(7) fixes. 2003-05-22 13:02:28 +00:00
libform Make this a little easier to build standalone. (same change as libpanel) 2002-05-21 07:08:30 +00:00
libftpio english(4) police. 2002-12-27 12:15:40 +00:00
libgeom Moved libgeom.so dependencies to where they belong. 2003-05-17 19:05:17 +00:00
libio
libipsec Buffer size is not enough in the previous commit. Use 128. 2003-04-17 07:20:00 +00:00
libipx Replace various spelling with FALLTHROUGH which is lint()able 2002-08-25 13:10:45 +00:00
libisc Zap now-unused SHLIB_MINOR 2002-09-28 00:25:32 +00:00
libkse Change low-level locking a bit so that we can tell if 2003-05-24 02:29:25 +00:00
libkvm Revamp of the syscall path, exception and context handling. The 2003-05-16 21:26:42 +00:00
libmd The .Fn function 2003-03-24 16:02:05 +00:00
libmenu Make this a little easier to build standalone. (same change as libpanel) 2002-05-21 07:08:30 +00:00
libmilter Added new bsd.incs.mk which handles installing of header files 2002-05-12 16:01:00 +00:00
libmp Adjust for OpenSSL 0.9.7. 2003-01-28 23:03:15 +00:00
libncp No need to have ifdef < FreeBSD 4.0-current in here. Remove it to 2003-04-04 04:16:06 +00:00
libncurses Symlink with -f. 2003-04-30 15:49:40 +00:00
libnetgraph Correct typos, mostly s/ a / an / where appropriate. Some whitespace cleanup, 2003-01-01 18:49:04 +00:00
libopie Drop login.c and logwtmp.c from the library build. None of the apps 2002-10-04 00:24:31 +00:00
libpam mdoc(7) fixes. 2003-05-24 19:53:08 +00:00
libpanel Initial update of bmake glue for ncurses-5.2-20020518 2002-05-21 05:41:07 +00:00
libpcap Zap now-unused SHLIB_MINOR 2002-09-28 00:25:32 +00:00
libpthread mdoc(7) fixes. 2003-05-24 19:53:08 +00:00
libradius Zap now-unused SHLIB_MINOR 2002-09-28 00:25:32 +00:00
librpcsvc make rstat(3) return an 'enum clnt_stat' rather than an 'int' to match 2002-10-01 22:02:06 +00:00
libsbuf Enable WARNS?=2. 2002-01-06 08:47:19 +00:00
libsm Removed now unused INTERNALSTATICLIB. 2002-05-13 11:09:07 +00:00
libsmb Zap now-unused SHLIB_MINOR 2002-09-28 00:25:32 +00:00
libsmdb Removed now unused INTERNALSTATICLIB. 2002-05-13 11:09:07 +00:00
libsmutil Removed now unused INTERNALSTATICLIB. 2002-05-13 11:09:07 +00:00
libstand Restore bzip2(1) support in loader(8) after Peter's renames of 2003-04-25 06:44:56 +00:00
libtacplus mdoc(7) police: formatting nits. 2002-11-29 15:57:50 +00:00
libtelnet Removed now unused INTERNALSTATICLIB. 2002-05-13 11:09:07 +00:00
libthr Start locking up the active and dead threads lists. The active threads 2003-05-25 08:31:33 +00:00
libufs MFp4: Fix copy&paste English error. 2003-03-30 18:00:24 +00:00
libugidfw Correct a couple small typos. 2003-01-07 13:18:21 +00:00
libusbhid Assorted mdoc(7) fixes. 2003-05-22 13:02:28 +00:00
libutil Backout last commit. It is redundant in -CURRENT. 2003-05-05 06:25:03 +00:00
libvgl Correct typos, mostly s/ a / an / where appropriate. Some whitespace cleanup, 2003-01-01 18:49:04 +00:00
libwrap Following MLINKS added, which point to host_access(3): 2003-05-12 21:59:16 +00:00
libxpg4 Zap now-unused SHLIB_MINOR 2002-09-28 00:25:32 +00:00
liby Zap now-unused SHLIB_MINOR 2002-09-28 00:25:32 +00:00
libypclnt style.Makefile(5) police. 2003-03-09 19:56:21 +00:00
libz In src/lib/libz/gzio.c the function gzprintf does not check if the 2003-03-14 01:47:01 +00:00
msun Fix two misuses of __BSD_VISIBLE. 2003-05-22 17:07:57 +00:00
ncurses Symlink with -f. 2003-04-30 15:49:40 +00:00
Makefile Retire the useless NOSECURE knob. 2003-05-19 15:52:01 +00:00
Makefile.inc Zap now-unused SHLIB_MINOR 2002-09-28 00:25:32 +00:00