diff --git a/y_worker_t/src/y_worker_t/y_task_t.c b/y_worker_t/src/y_worker_t/y_task_t.c index 0391361..a01759e 100644 --- a/y_worker_t/src/y_worker_t/y_task_t.c +++ b/y_worker_t/src/y_worker_t/y_task_t.c @@ -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; } diff --git a/y_worker_t/src/y_worker_t/y_worker_t.c b/y_worker_t/src/y_worker_t/y_worker_t.c index ce7a8b8..3d0e1fc 100644 --- a/y_worker_t/src/y_worker_t/y_worker_t.c +++ b/y_worker_t/src/y_worker_t/y_worker_t.c @@ -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); diff --git a/ytest_t/include_ytest/include/ftest/ftest.h b/ytest_t/include_ytest/include/ftest/ftest.h index ac77c0c..5d9d9b3 100644 --- a/ytest_t/include_ytest/include/ftest/ftest.h +++ b/ytest_t/include_ytest/include/ftest/ftest.h @@ -103,6 +103,9 @@ extern char *varHK_EQ, *varHK_TR, *varHK_RN, *varHK_DN, *varHK_OK, *varHK_FL, *v if(id_thread >= 0){\ fprintf(f_ou_th[id_thread], "%s",buf);\ fflush(f_ou_th[id_thread]);\ + }else{\ + fprintf(f_ou_th[parallel_nb], "%s",buf);\ + fflush(f_ou_th[parallel_nb]);\ }\ }\ else{\ @@ -112,6 +115,8 @@ extern char *varHK_EQ, *varHK_TR, *varHK_RN, *varHK_DN, *varHK_OK, *varHK_FL, *v }\ else {\ 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 size_t parallel_nb ; long int id_of_thread_executed(const char *func_call_name); diff --git a/ytest_t/libytest.so b/ytest_t/libytest.so index 1a01539..14cf38a 100755 Binary files a/ytest_t/libytest.so and b/ytest_t/libytest.so differ diff --git a/ytest_t/yftest/include/ftest/ftest.h b/ytest_t/yftest/include/ftest/ftest.h index ac77c0c..5d9d9b3 100644 --- a/ytest_t/yftest/include/ftest/ftest.h +++ b/ytest_t/yftest/include/ftest/ftest.h @@ -103,6 +103,9 @@ extern char *varHK_EQ, *varHK_TR, *varHK_RN, *varHK_DN, *varHK_OK, *varHK_FL, *v if(id_thread >= 0){\ fprintf(f_ou_th[id_thread], "%s",buf);\ fflush(f_ou_th[id_thread]);\ + }else{\ + fprintf(f_ou_th[parallel_nb], "%s",buf);\ + fflush(f_ou_th[parallel_nb]);\ }\ }\ else{\ @@ -112,6 +115,8 @@ extern char *varHK_EQ, *varHK_TR, *varHK_RN, *varHK_DN, *varHK_OK, *varHK_FL, *v }\ else {\ 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 size_t parallel_nb ; long int id_of_thread_executed(const char *func_call_name);