From 775f6cbb5d800c6dc223b3810b92b1e3e9540fdd Mon Sep 17 00:00:00 2001 From: Michael Ploujnikov Date: Sun, 22 Nov 2009 20:08:08 -0500 Subject: [PATCH] actually create or use a thread struct, still not associated with a pthread --- src/backend/threadpool.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/backend/threadpool.c b/src/backend/threadpool.c index 27729895b..70dbb528d 100644 --- a/src/backend/threadpool.c +++ b/src/backend/threadpool.c @@ -194,7 +194,16 @@ lumiera_threadpool_acquire_thread(enum lumiera_thread_class kind, return (LumieraThreadpool)0; } - // TODO: either get a thread from the pool or create a new one + if (llist_is_empty (tp->threads)) + { + // how does this become an actual pthread? + return lumiera_thread_new (kind, NULL, purpose, flag); + } + else + { + // use an existing thread, pick the first one + return (LumieraThread)(llist_head (&tp->threads)); + } } LumieraThreadpool