modify parallel log ftest, if parallel save log in main thread if the thread is not one of tests threadgit status !

This commit is contained in:
2025-06-06 23:34:05 +02:00
parent 4bcdf96c12
commit b7f7bb26c5
5 changed files with 25 additions and 13 deletions
+8 -8
View File
@@ -26,28 +26,28 @@ void free_y_tasQ(struct y_tasQ * tasQ){
} }
void push_tasQ(struct y_tasQ *tasQ, struct y_task_t task){ void push_tasQ(struct y_tasQ *tasQ, struct y_task_t task){
printf("debug: push_tasQ debut\n"); //printf("debug: push_tasQ debut\n");
pthread_mutex_lock(tasQ->mut_tasQ); pthread_mutex_lock(tasQ->mut_tasQ);
push_back_list_y_TASK_T(tasQ->list_tasQ, task); push_back_list_y_TASK_T(tasQ->list_tasQ, task);
pthread_mutex_unlock(tasQ->mut_tasQ); pthread_mutex_unlock(tasQ->mut_tasQ);
pthread_cond_signal(tasQ->cond_tasQ); pthread_cond_signal(tasQ->cond_tasQ);
printf("debug: push_tasQ fin\n"); //printf("debug: push_tasQ fin\n");
} }
struct list_y_TASK_T* pull_tasQ(struct y_tasQ *tasQ){ struct list_y_TASK_T* pull_tasQ(struct y_tasQ *tasQ){
printf("debug: pull_tasQ debut id_th:%ld\n",pthread_self()); //printf("debug: pull_tasQ debut id_th:%ld\n",pthread_self());
struct list_y_TASK_T *valueRet = NULL; struct list_y_TASK_T *valueRet = NULL;
pthread_mutex_lock(tasQ->mut_tasQ); pthread_mutex_lock(tasQ->mut_tasQ);
while(tasQ->list_tasQ->end_list == NULL){ while(tasQ->list_tasQ->end_list == NULL){
pthread_cond_wait(tasQ->cond_tasQ, tasQ->mut_tasQ); pthread_cond_wait(tasQ->cond_tasQ, tasQ->mut_tasQ);
} }
printf("debug: call pull_begin_from_list_y_TASK_T debut\n"); //printf("debug: call pull_begin_from_list_y_TASK_T debut\n");
valueRet = pull_begin_from_list_y_TASK_T(tasQ->list_tasQ); valueRet = pull_begin_from_list_y_TASK_T(tasQ->list_tasQ);
// valueRet = pull_end_from_list_y_TASK_T(tasQ->list_tasQ); // valueRet = pull_end_from_list_y_TASK_T(tasQ->list_tasQ);
printf("debug: call pull_begin_from_list_y_TASK_T fin, is tasQ NULL? : %d\nis tasQ->list_tasQ NULL?:%d\n", tasQ==NULL, tasQ->list_tasQ == NULL); //printf("debug: call pull_begin_from_list_y_TASK_T fin, is tasQ NULL? : %d\nis tasQ->list_tasQ NULL?:%d\n", tasQ==NULL, tasQ->list_tasQ == NULL);
pthread_mutex_unlock(tasQ->mut_tasQ); pthread_mutex_unlock(tasQ->mut_tasQ);
printf("debug: pull_tasQ fin : is valueRet NULL ? = %d, id_th:%ld\n", valueRet == NULL, pthread_self()); //printf("debug: pull_tasQ fin : is valueRet NULL ? = %d, id_th:%ld\n", valueRet == NULL, pthread_self());
return valueRet; return valueRet;
} }
@@ -80,7 +80,7 @@ void * execute_task(void *arg){
while(check_go_on_tasQ(argx)){ while(check_go_on_tasQ(argx)){
l_task = pull_tasQ(tasQ); l_task = pull_tasQ(tasQ);
printf("debug: is l_task NULL? = %d\n", l_task==NULL); //printf("debug: is l_task NULL? = %d\n", l_task==NULL);
if(l_task){ if(l_task){
if((l_task->value.status != TASK_DONE) && (l_task->value.func!=NULL)) if((l_task->value.status != TASK_DONE) && (l_task->value.func!=NULL))
l_task->value.ret = l_task->value.func(l_task->value.arg); l_task->value.ret = l_task->value.func(l_task->value.arg);
@@ -93,7 +93,7 @@ void * execute_task(void *arg){
} }
printf("debug: -------------------> exit task exec \n"); //printf("debug: -------------------> exit task exec \n");
// usleep(1000); // usleep(1000);
return NULL; return NULL;
} }
+5 -5
View File
@@ -86,21 +86,21 @@ void* execute_work(void* arg){
pworker->id_thread=id_thread; pworker->id_thread=id_thread;
pthread_mutex_unlock(pworker->mut_worker); pthread_mutex_unlock(pworker->mut_worker);
pthread_cond_signal(pworker->cond_worker); pthread_cond_signal(pworker->cond_worker);
printf("debug: ############################ execute_task call : thread_id:%ld, self=%ld \n",pworker->id,id_thread); //printf("debug: ############################ execute_task call : thread_id:%ld, self=%ld \n",pworker->id,id_thread);
do{ do{
printf("debug: execute_task call : thread_id:%ld, self=%ld \n",pworker->id,id_thread); //printf("debug: execute_task call : thread_id:%ld, self=%ld \n",pworker->id,id_thread);
execute_task((void*)argx); execute_task((void*)argx);
printf("debug: <<<<>>>> execute_task end, worker exec=%d id:%ld self:%ld \n",exec,pworker->id, pworker->id_thread); //printf("debug: <<<<>>>> execute_task end, worker exec=%d id:%ld self:%ld \n",exec,pworker->id, pworker->id_thread);
pthread_mutex_lock(pworker->mut_worker); pthread_mutex_lock(pworker->mut_worker);
exec=pworker->exec; exec=pworker->exec;
pthread_mutex_unlock(pworker->mut_worker); pthread_mutex_unlock(pworker->mut_worker);
printf("debug: execute_task end, worker exec=%d id:%ld self:%ld \n",exec,pworker->id, pworker->id_thread); //printf("debug: execute_task end, worker exec=%d id:%ld self:%ld \n",exec,pworker->id, pworker->id_thread);
}while(exec); }while(exec);
pthread_mutex_lock(pworker->mut_worker); pthread_mutex_lock(pworker->mut_worker);
pworker->status=WORKER_OFF; pworker->status=WORKER_OFF;
printf("debug: =========>>> execute_task end, worker OFF =%d, id=%ld self:%ld\n",pworker->status, pworker->id, pworker->id_thread); //printf("debug: =========>>> execute_task end, worker OFF =%d, id=%ld self:%ld\n",pworker->status, pworker->id, pworker->id_thread);
pthread_mutex_unlock(pworker->mut_worker); pthread_mutex_unlock(pworker->mut_worker);
pthread_cond_signal(pworker->cond_worker); pthread_cond_signal(pworker->cond_worker);
// usleep(1000); // usleep(1000);
@@ -103,6 +103,9 @@ extern char *varHK_EQ, *varHK_TR, *varHK_RN, *varHK_DN, *varHK_OK, *varHK_FL, *v
if(id_thread >= 0){\ if(id_thread >= 0){\
fprintf(f_ou_th[id_thread], "%s",buf);\ fprintf(f_ou_th[id_thread], "%s",buf);\
fflush(f_ou_th[id_thread]);\ fflush(f_ou_th[id_thread]);\
}else{\
fprintf(f_ou_th[parallel_nb], "%s",buf);\
fflush(f_ou_th[parallel_nb]);\
}\ }\
}\ }\
else{\ else{\
@@ -112,6 +115,8 @@ extern char *varHK_EQ, *varHK_TR, *varHK_RN, *varHK_DN, *varHK_OK, *varHK_FL, *v
}\ }\
else {\ else {\
fprintf(F_OUT, "%s",buf);\ fprintf(F_OUT, "%s",buf);\
fprintf(f_ou_th[parallel_nb], "%s",buf);\
fflush(f_ou_th[parallel_nb]);\
}\ }\
}\ }\
} \ } \
@@ -158,6 +163,7 @@ struct func {
extern bool is_parallel_nb; extern bool is_parallel_nb;
extern size_t parallel_nb ;
long int id_of_thread_executed(const char *func_call_name); long int id_of_thread_executed(const char *func_call_name);
Binary file not shown.
+6
View File
@@ -103,6 +103,9 @@ extern char *varHK_EQ, *varHK_TR, *varHK_RN, *varHK_DN, *varHK_OK, *varHK_FL, *v
if(id_thread >= 0){\ if(id_thread >= 0){\
fprintf(f_ou_th[id_thread], "%s",buf);\ fprintf(f_ou_th[id_thread], "%s",buf);\
fflush(f_ou_th[id_thread]);\ fflush(f_ou_th[id_thread]);\
}else{\
fprintf(f_ou_th[parallel_nb], "%s",buf);\
fflush(f_ou_th[parallel_nb]);\
}\ }\
}\ }\
else{\ else{\
@@ -112,6 +115,8 @@ extern char *varHK_EQ, *varHK_TR, *varHK_RN, *varHK_DN, *varHK_OK, *varHK_FL, *v
}\ }\
else {\ else {\
fprintf(F_OUT, "%s",buf);\ fprintf(F_OUT, "%s",buf);\
fprintf(f_ou_th[parallel_nb], "%s",buf);\
fflush(f_ou_th[parallel_nb]);\
}\ }\
}\ }\
} \ } \
@@ -158,6 +163,7 @@ struct func {
extern bool is_parallel_nb; extern bool is_parallel_nb;
extern size_t parallel_nb ;
long int id_of_thread_executed(const char *func_call_name); long int id_of_thread_executed(const char *func_call_name);