diff options
author | jb <jb@FreeBSD.org> | 1998-09-30 06:36:56 +0000 |
---|---|---|
committer | jb <jb@FreeBSD.org> | 1998-09-30 06:36:56 +0000 |
commit | df42f1ac5f49d30528909286a925e0d7492bc337 (patch) | |
tree | f3bf279acabc8ce90e6bbf65e33a722b578cebfb /gnu/lib/libdialog/tree.c | |
parent | d76ace8cb5de85bc8d0e7bcd29ff688098b1de96 (diff) | |
download | FreeBSD-src-df42f1ac5f49d30528909286a925e0d7492bc337.zip FreeBSD-src-df42f1ac5f49d30528909286a925e0d7492bc337.tar.gz |
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.
Diffstat (limited to 'gnu/lib/libdialog/tree.c')
0 files changed, 0 insertions, 0 deletions