summaryrefslogtreecommitdiffstats
path: root/lib/libthr
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libthr')
-rw-r--r--lib/libthr/thread/thr_init.c8
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
OpenPOWER on IntegriCloud