diff --git a/src/backend/threadpool.c b/src/backend/threadpool.c index d4636c196..d286db105 100644 --- a/src/backend/threadpool.c +++ b/src/backend/threadpool.c @@ -147,7 +147,6 @@ lumiera_threadpool_acquire_thread (enum lumiera_thread_class kind, return ret; } -// TODO: rename to lumiera_threadpool_park_thread void lumiera_threadpool_release_thread(LumieraThread thread) { diff --git a/src/backend/threads.c b/src/backend/threads.c index 204144ad7..6b949265b 100644 --- a/src/backend/threads.c +++ b/src/backend/threads.c @@ -166,7 +166,7 @@ lumiera_thread_new (enum lumiera_thread_class kind, { pthread_once (&lumiera_thread_initialized, lumiera_thread_tls_init); - // TODO: do something with these: + // TODO: do something with this string: (void) purpose; REQUIRE (attrs, "invalid pthread attributes structure passed"); diff --git a/tests/30backend-threadpool.tests b/tests/30backend-threadpool.tests index 6ba717091..6945d4d5d 100644 --- a/tests/30backend-threadpool.tests +++ b/tests/30backend-threadpool.tests @@ -10,7 +10,17 @@ END TEST "process a function" process-function <= sqrt(number); --x) + for (unsigned long long x = number-1; x >= sqrt(number); --x) { - if (number % x == 0) + if ((number % x) == 0) { prime = 0; break; } } - *(int *)arg = prime; + *(unsigned long long *)arg = prime; } TESTS_BEGIN @@ -66,7 +66,7 @@ TEST ("threadpool1") } -TEST ("basic-acquire-release") +TEST ("two-thread-acquire") { ECHO("start by initializing the threadpool"); lumiera_threadpool_init(); @@ -90,13 +90,7 @@ TEST ("basic-acquire-release") ECHO("thread 2 state=%s", lumiera_threadstate_names[t2->state]); CHECK(LUMIERA_THREADSTATE_IDLE == t2->state); - ECHO("releasing thread 1"); - //lumiera_threadpool_release_thread(t1); - ECHO("thread 1 has been released"); - - ECHO("releasing thread 2"); - //lumiera_threadpool_release_thread(t2); - ECHO("thread 2 has been released"); + ECHO("cleaning up"); lumiera_threadpool_destroy(); } @@ -180,11 +174,11 @@ TEST ("process-function") { // this is what the scheduler would do once it figures out what function a job needs to run LumieraThread t; - int number = 1073676287; + unsigned long long number = 10000019; lumiera_threadpool_init(); - ECHO ("the input to the function is %d", number); + ECHO ("the input to the function is %llu", number); t = lumiera_thread_run (LUMIERA_THREADCLASS_INTERACTIVE, &is_prime, @@ -193,8 +187,9 @@ TEST ("process-function") &NOBUG_FLAG(NOBUG_ON)); // struct nobug_flag* flag) // cleanup - ECHO("finished waiting"); lumiera_threadpool_destroy(); + ECHO("the result is %llu", number); + } TESTS_END