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){
printf("debug: push_tasQ debut\n");
//printf("debug: push_tasQ debut\n");
pthread_mutex_lock(tasQ->mut_tasQ);
push_back_list_y_TASK_T(tasQ->list_tasQ, task);
pthread_mutex_unlock(tasQ->mut_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){
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;
pthread_mutex_lock(tasQ->mut_tasQ);
while(tasQ->list_tasQ->end_list == NULL){
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_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);
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;
}
@@ -80,7 +80,7 @@ void * execute_task(void *arg){
while(check_go_on_tasQ(argx)){
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->value.status != TASK_DONE) && (l_task->value.func!=NULL))
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);
return NULL;
}
+5 -5
View File
@@ -86,21 +86,21 @@ void* execute_work(void* arg){
pworker->id_thread=id_thread;
pthread_mutex_unlock(pworker->mut_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{
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);
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);
exec=pworker->exec;
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);
pthread_mutex_lock(pworker->mut_worker);
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_cond_signal(pworker->cond_worker);
// usleep(1000);