diff --git a/src/backend/threadpool.c b/src/backend/threadpool.c index 608088137..a6d58cfe0 100644 --- a/src/backend/threadpool.c +++ b/src/backend/threadpool.c @@ -85,6 +85,14 @@ lumiera_threadpool_acquire_thread(enum lumiera_thread_class kind, } } +void +lumiera_threadpool_release_thread(LumieraThread thread) +{ + // TODO: do we need to check that index 'kind' is within range? + llist pool = threadpool.kind[thread->kind].pool; + llist_insert_head(&pool, &thread->node); +} + /* // Local Variables: // mode: C diff --git a/src/backend/threads.c b/src/backend/threads.c index 2c8548928..7b18ab70a 100644 --- a/src/backend/threads.c +++ b/src/backend/threads.c @@ -161,7 +161,7 @@ lumiera_thread_new (enum lumiera_thread_class kind, llist_init(&self->node); // self->id = (pthread_t)NULL; initialized by pthread_create() self->finished = finished; - self->type = kind; + self->kind = kind; self->state = LUMIERA_THREADSTATE_IDLE; printf("creating a thread\n"); diff --git a/src/backend/threads.h b/src/backend/threads.h index 67c036001..ec93c4df6 100644 --- a/src/backend/threads.h +++ b/src/backend/threads.h @@ -105,7 +105,7 @@ struct lumiera_thread_struct // void* arg; pthread_t id; LumieraReccondition finished; - enum lumiera_thread_class type; + enum lumiera_thread_class kind; lumiera_thread_state state; }; diff --git a/tests/50threadpool.tests b/tests/50threadpool.tests index eadb1cd32..935fb7169 100644 --- a/tests/50threadpool.tests +++ b/tests/50threadpool.tests @@ -4,9 +4,9 @@ TEST "Acquire/Release test" basic-acquire-release <kind); + printf("thread 1 state=%d\n", t1->state); + printf("thread 2 kind=%d\n", t2->kind); + printf("thread 2 state=%d\n", t2->state); printf("releasing thread 1\n"); lumiera_threadpool_release_thread(t1);