mirror of
https://github.com/Pithikos/C-Thread-Pool
synced 2024-11-25 14:59:37 +03:00
Test updates
This commit is contained in:
parent
b38f0f35c4
commit
2eed00fceb
@ -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
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user