diff options
author | mtm <mtm@FreeBSD.org> | 2004-06-27 09:53:06 +0000 |
---|---|---|
committer | mtm <mtm@FreeBSD.org> | 2004-06-27 09:53:06 +0000 |
commit | b1b2cf639ed41a4b5caeec9fcfe87e0c8aef950c (patch) | |
tree | b3b09f6ee52944df716fed46a813bf568c4926b1 /lib/libthr/thread/thr_init.c | |
parent | 537ad587c5d79f4e7f11f710155eed0f30f52438 (diff) | |
download | FreeBSD-src-b1b2cf639ed41a4b5caeec9fcfe87e0c8aef950c.zip FreeBSD-src-b1b2cf639ed41a4b5caeec9fcfe87e0c8aef950c.tar.gz |
In the case that the global thread list is being re-initialized after
a fork, make sure that the current thread isn't detached and freed. As
a consequence the thread should be inserted into the head of the
active list only once (in the beginning).
Diffstat (limited to 'lib/libthr/thread/thr_init.c')
-rw-r--r-- | lib/libthr/thread/thr_init.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/libthr/thread/thr_init.c b/lib/libthr/thread/thr_init.c index 98c355a..cf1eb6b 100644 --- a/lib/libthr/thread/thr_init.c +++ b/lib/libthr/thread/thr_init.c @@ -205,7 +205,7 @@ init_tdlist(struct pthread *td, int reinit) */ if (reinit) { TAILQ_FOREACH_SAFE(tdTemp, &_thread_list, tle, tdTemp2) { - if (tdTemp != NULL) { + if (tdTemp != NULL && tdTemp != td) { TAILQ_REMOVE(&_thread_list, tdTemp, tle); free(tdTemp); } @@ -220,10 +220,10 @@ init_tdlist(struct pthread *td, int reinit) } else { TAILQ_INIT(&_thread_list); TAILQ_INIT(&_dead_list); - } - /* Insert this thread as the first thread in the active list */ - TAILQ_INSERT_HEAD(&_thread_list, td, tle); + /* Insert this thread as the first thread in the active list */ + TAILQ_INSERT_HEAD(&_thread_list, td, tle); + } /* * Initialize the active thread list lock and the |