Test updates

This commit is contained in:
Pithikos 2015-01-18 10:41:59 +00:00
parent b38f0f35c4
commit 2eed00fceb
2 changed files with 7 additions and 2 deletions

View File

@ -33,13 +33,14 @@ int main(int argc, char *argv[]){
thpool_pause(thpool); 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);
thpool_add_work(thpool, (void*)sleep_4_secs, NULL); thpool_add_work(thpool, (void*)sleep_4_secs, NULL);
sleep(3); sleep(3);
// Now we will start threads in no-parallel with main
thpool_resume(thpool); thpool_resume(thpool);
// If it works, then the threadpool starts working NOW
sleep(2); // Give some time to threads to get the work sleep(2); // Give some time to threads to get the work

View File

@ -27,10 +27,14 @@ int main(int argc, char *argv[]){
puts("This testfile needs excactly three arguments"); puts("This testfile needs excactly three arguments");
exit(1); exit(1);
} }
int num_jobs = strtol(argv[1], &p, 10); int num_jobs = strtol(argv[1], &p, 10);
int num_threads = strtol(argv[2], &p, 10); int num_threads = strtol(argv[2], &p, 10);
int wait_each_job = strtol(argv[3], &p, 10); int wait_each_job = strtol(argv[3], &p, 10);
printf("%d\n", wait_each_job);
threadpool thpool = thpool_init(num_threads); threadpool thpool = thpool_init(num_threads);
int n; int n;