You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I removed the condition in for-loop in threadpool_example.c to make an infinite loop and then the used memory is continuously rising. Is it the normal situation?
#include<stdio.h>
#if defined __GNUC__ || defined __CYGWIN__ || defined __MINGW32__ || defined __APPLE__
#include<pthread.h>
#elif defined _WIN32 || _WIN64
#include<windows.h>
#include<Windows.h>
#endif
#include"at_thpool.h"
#defineTASK_SIZE200voidt1(void *arg);
voidt2(void *arg);
voidt3(void *arg);
voidt4(void *arg);
voidt1(void *arg) {
printf("t1 is running on thread \n");
}
voidt2(void *arg) {
printf("t2 is running on thread \n");
}
voidt3(void *arg) {
printf("t3 is running on thread \n");
}
voidt4(void *arg) {
printf("t4 is running on thread \n");
}
intmain(void) {
int nthreads = 8;//sysconf(_SC_NPROCESSORS_ONLN); // Linuxprintf("Share thread pool with %d threads with at lease totalthroughput * nthreads task size\n", nthreads);
at_thpool_t *thpool = at_thpool_create(nthreads);
printf("assigned %d tasks between %d threads\n", TASK_SIZE, nthreads);
int i;
for (i = 0; ; i++) { // here remove the conditionat_thpool_newtask(thpool, t1, NULL);
at_thpool_newtask(thpool, t2, NULL);
at_thpool_newtask(thpool, t3, NULL);
at_thpool_newtask(thpool, t4, NULL);
}
#if defined _WIN32 || _WIN64
Sleep(1000);
#elsesleep(1);
#endifputs("shutdown thread pool");
at_thpool_gracefully_shutdown(thpool);
return0;
}
The text was updated successfully, but these errors were encountered:
I removed the condition in for-loop in
threadpool_example.c
to make an infinite loop and then the used memory is continuously rising. Is it the normal situation?The text was updated successfully, but these errors were encountered: