#include "thread_pool.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
void print_val(void *val) {
const int ms100 = 1000 * 1;
usleep(ms100);
printf("%d\n", *(int *)val);
free(val);
}
int main() {
threadpool_t *pool = threadpool_create(10, 50);
for (int i = 0; i < 40; i++) {
int *val = malloc(sizeof(int));
*val = i;
threadpool_run(pool, print_val, val);
}
threadpool_destroy(pool, 1);
}
-
Notifications
You must be signed in to change notification settings - Fork 0
kritma/tread_pool
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published