Date: Tue, 29 Sep 1998 23:36:56 -0700 (PDT) From: John Birrell <jb@FreeBSD.ORG> To: cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG Subject: cvs commit: src/lib/libc_r/uthread uthread_gc.c Makefile.inc uthread_init.c uthread_find_thread.c uthread_kern.c uthread_create.c uthread_exit.c Message-ID: <199809300636.XAA11479@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
jb 1998/09/29 23:36:56 PDT
Modified files:
lib/libc_r/uthread Makefile.inc uthread_init.c
uthread_find_thread.c uthread_kern.c
uthread_create.c uthread_exit.c
Added files:
lib/libc_r/uthread uthread_gc.c
Log:
Move the cleanup code that frees memory allocated for a dead thread from
the thread kernel into a garbage collector thread which is started when
the fisrt thread is created (other than the initial thread). This
removes the window of opportunity where a context switch will cause a
thread that has locked the malloc spinlock, to enter the thread kernel,
find there is a dead thread and try to free memory, therefore trying
to lock the malloc spinlock against itself.
The garbage collector thread acts just like any other thread, so
instead of having a spinlock to control accesses to the dead thread
list, it uses a mutex and a condition variable so that it can happily
wait to be signalled when a thread exists.
Revision Changes Path
1.16 +2 -1 src/lib/libc_r/uthread/Makefile.inc
1.9 +5 -0 src/lib/libc_r/uthread/uthread_init.c
1.2 +10 -5 src/lib/libc_r/uthread/uthread_find_thread.c
1.13 +2 -80 src/lib/libc_r/uthread/uthread_kern.c
1.10 +16 -0 src/lib/libc_r/uthread/uthread_create.c
1.6 +17 -44 src/lib/libc_r/uthread/uthread_exit.c
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199809300636.XAA11479>
