From 75696986e4b87380b03a5afa4923f49b389ffc73 Mon Sep 17 00:00:00 2001 From: Michael Ploujnikov Date: Mon, 23 Nov 2009 19:05:57 -0500 Subject: [PATCH] test passes --- src/backend/threadpool.c | 5 ++--- tests/30backend-threadpool.tests | 13 ++++++++++++- tests/50threadpool.tests | 15 --------------- tests/backend/test-threadpool.c | 26 +++++++++++++++----------- 4 files changed, 29 insertions(+), 30 deletions(-) delete mode 100644 tests/50threadpool.tests diff --git a/src/backend/threadpool.c b/src/backend/threadpool.c index a6d58cfe0..063794012 100644 --- a/src/backend/threadpool.c +++ b/src/backend/threadpool.c @@ -37,8 +37,7 @@ static lumiera_threadpool threadpool; * @file * */ - -//NOBUG_DEFINE_FLAG_PARENT (threadpool, lumiera); /*TODO insert a suitable/better parent flag here */ +NOBUG_DEFINE_FLAG_PARENT (threadpool, threads_dbg); //code goes here// @@ -59,7 +58,7 @@ lumiera_threadpool_init(void) for (int i = 0; i < LUMIERA_THREADCLASS_COUNT; ++i) { llist_init(&threadpool.kind[i].pool); - lumiera_mutex_init(&threadpool.kind[i].lock,"pool of threads", NULL); + lumiera_mutex_init(&threadpool.kind[i].lock,"pool of threads", &NOBUG_FLAG(threadpool)); } } diff --git a/tests/30backend-threadpool.tests b/tests/30backend-threadpool.tests index dc178ba91..16fd316d4 100644 --- a/tests/30backend-threadpool.tests +++ b/tests/30backend-threadpool.tests @@ -1,6 +1,17 @@ -TESTING "Thread Pools" +TESTING "Thread Pools" ./test-threadpool PLANNED "create" PLANNED "yield" PLANNED "cancel" + +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); + //ECHO("thread 1 kind=%d", t1->kind); + CHECK(LUMIERA_THREAD_INTERACTIVE == t1->kind); + //ECHO("thread 1 state=%d", t1->state); + CHECK(LUMIERA_THREADSTATE_IDLE == t1->state); + //ECHO("thread 2 kind=%d", t2->kind); + // CHECK(LUMIERA_THREAD_IDLE == t2->kind); + //ECHO("thread 2 state=%d", t2->state); + CHECK(LUMIERA_THREADSTATE_IDLE == t2->state); - printf("releasing thread 1\n"); + ECHO("releasing thread 1"); lumiera_threadpool_release_thread(t1); - printf("thread 1 has been released\n"); + ECHO("thread 1 has been released"); - printf("releasing thread 2\n"); + ECHO("releasing thread 2"); lumiera_threadpool_release_thread(t2); - printf("thread 2 has been released\n"); + ECHO("thread 2 has been released"); } TESTS_END