From 2eed00fceb39bb61ed33608352d08d37c91c9dd4 Mon Sep 17 00:00:00 2001 From: Pithikos Date: Sun, 18 Jan 2015 10:41:59 +0000 Subject: [PATCH] Test updates --- tests/src/pause_resume.c | 5 +++-- tests/src/wait.c | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/src/pause_resume.c b/tests/src/pause_resume.c index 662763f..282c398 100644 --- a/tests/src/pause_resume.c +++ b/tests/src/pause_resume.c @@ -33,14 +33,15 @@ int main(int argc, char *argv[]){ thpool_pause(thpool); + // Since pool is paused, threads should not start before main's sleep thpool_add_work(thpool, (void*)sleep_4_secs, NULL); thpool_add_work(thpool, (void*)sleep_4_secs, NULL); sleep(3); + // Now we will start threads in no-parallel with main thpool_resume(thpool); - // If it works, then the threadpool starts working NOW - + sleep(2); // Give some time to threads to get the work thpool_destroy(thpool); // Wait for work to finish diff --git a/tests/src/wait.c b/tests/src/wait.c index acfc00c..df2ff77 100644 --- a/tests/src/wait.c +++ b/tests/src/wait.c @@ -27,9 +27,13 @@ int main(int argc, char *argv[]){ puts("This testfile needs excactly three arguments"); exit(1); } + + int num_jobs = strtol(argv[1], &p, 10); int num_threads = strtol(argv[2], &p, 10); int wait_each_job = strtol(argv[3], &p, 10); + + printf("%d\n", wait_each_job); threadpool thpool = thpool_init(num_threads);