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).
This commit is contained in:
Mike Makonnen 2004-06-27 09:53:06 +00:00
parent 0a44517d3a
commit 356c2d4f58

View File

@ -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