summaryrefslogtreecommitdiff
path: root/thread_pthread.c
diff options
context:
space:
mode:
Diffstat (limited to 'thread_pthread.c')
-rw-r--r--thread_pthread.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/thread_pthread.c b/thread_pthread.c
index b66273520a..8fb510e0e4 100644
--- a/thread_pthread.c
+++ b/thread_pthread.c
@@ -801,21 +801,14 @@ register_cached_thread_and_wait(void)
native_cond_timedwait(&cond, &thread_cache_lock, &ts);
{
- struct cached_thread_entry *e = cached_thread_root;
- struct cached_thread_entry *prev = cached_thread_root;
+ struct cached_thread_entry *e, **prev = &cached_thread_root;
- while (e) {
+ while ((e = *prev) != 0) {
if (e == entry) {
- if (prev == cached_thread_root) {
- cached_thread_root = e->next;
- }
- else {
- prev->next = e->next;
- }
+ *prev = e->next;
break;
}
- prev = e;
- e = e->next;
+ prev = &e->next;
}
}