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