From fa85a01818a339fee647ca24984d9c99f77eab30 Mon Sep 17 00:00:00 2001 From: Michael Ploujnikov Date: Sat, 16 Jan 2010 13:13:02 -0500 Subject: [PATCH] add a stronger REQUIRE check --- src/backend/threadpool.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/backend/threadpool.c b/src/backend/threadpool.c index 3f475d9d7..7633229f2 100644 --- a/src/backend/threadpool.c +++ b/src/backend/threadpool.c @@ -156,9 +156,12 @@ lumiera_threadpool_release_thread(LumieraThread thread) REQUIRE (thread->state != LUMIERA_THREADSTATE_IDLE, "trying to park an already idle thread"); LUMIERA_CONDITION_SECTION (threadpool, &threadpool.pool[thread->kind].sync) { - thread->state = LUMIERA_THREADSTATE_IDLE; REQUIRE (!llist_is_member (&threadpool.pool[thread->kind].idle_list, &thread->node), "thread is already in the idle list"); - // REQUIRE (llist_is_member (&threadpool.pool[thread->kind].working_list, &thread->node), "thread is not in the working list"); // does not make sense for when the thread was just created, check for state==STARTUP + REQUIRE (llist_is_member (&threadpool.pool[thread->kind].working_list, &thread->node) + || thread->state == LUMIERA_THREADSTATE_STARTUP, + "thread is not in the working list (state=%s)", + lumiera_threadstate_names[thread->state]); + thread->state = LUMIERA_THREADSTATE_IDLE; // move thread to the idle_list llist_insert_head (&threadpool.pool[thread->kind].idle_list, &thread->node);