From 6aacf490a339a8b9a93cae0c9458e9751da202e3 Mon Sep 17 00:00:00 2001 From: Michael Ploujnikov Date: Fri, 29 Jan 2010 22:41:41 -0500 Subject: [PATCH] add a comile-only test with threads sleeping for random intervals --- tests/backend/test-threadpool.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/backend/test-threadpool.c b/tests/backend/test-threadpool.c index dea6370f6..9a4033c4d 100644 --- a/tests/backend/test-threadpool.c +++ b/tests/backend/test-threadpool.c @@ -209,4 +209,27 @@ TEST ("process-function") } +TEST ("many-random-sleepy-threads (compiletest only)") +{ + const int threads_per_pool_count = 10; + unsigned int delay[threads_per_pool_count*LUMIERA_THREADCLASS_COUNT]; + lumiera_threadpool_init(); + LumieraThread threads[threads_per_pool_count*LUMIERA_THREADCLASS_COUNT]; + + for (int kind = 0; kind < LUMIERA_THREADCLASS_COUNT; ++kind) + { + for (int i = 0; i < threads_per_pool_count; ++i) + { + delay[i] = rand() % 1000000; + threads[i+kind*threads_per_pool_count] = + lumiera_thread_run(kind, + &sleep_fn, + (void *) &delay[i], + "just sleep a bit", + &NOBUG_FLAG(NOBUG_ON)); + } + } + lumiera_threadpool_destroy(); +} + TESTS_END