From ecbcfdefd78adbcef60f7a2b62f8f98d77494976 Mon Sep 17 00:00:00 2001 From: Michael Ploujnikov Date: Tue, 12 Jan 2010 07:39:12 -0500 Subject: [PATCH] remote unnecessary calls to llist_unlink() insert is enough --- src/backend/threadpool.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/backend/threadpool.c b/src/backend/threadpool.c index f08bfd0e0..c0757a28d 100644 --- a/src/backend/threadpool.c +++ b/src/backend/threadpool.c @@ -115,12 +115,13 @@ lumiera_threadpool_acquire_thread(enum lumiera_thread_class kind, } // use an existing thread, pick the first one // remove it from the pool's list - ret = (LumieraThread)(llist_unlink (llist_head (&threadpool.pool[kind].idle_list))); + ret = (LumieraThread) (llist_head (&threadpool.pool[kind].idle_list)); ENSURE (ret, "did not find a valid thread"); REQUIRE (ret->state == LUMIERA_THREADSTATE_IDLE, "trying to return a non-idle thread (state=%s)", lumiera_threadstate_names[ret->state]); + // move thread to the working_list llist_insert_head (&threadpool.pool[kind].working_list, ret); threadpool.pool[kind].working_thread_count++; @@ -153,7 +154,7 @@ lumiera_threadpool_release_thread(LumieraThread thread) { thread->state = LUMIERA_THREADSTATE_IDLE; REQUIRE (llist_is_empty (&thread->node), "thread already belongs to some list"); - llist_unlink (&thread); // remove thread from the working_list + // move thread to the idle_list llist_insert_head (&threadpool.pool[thread->kind].idle_list, &thread->node); threadpool.pool[thread->kind].working_thread_count--;