Commit 71a98a97 authored by Wang Tsu-Han's avatar Wang Tsu-Han

bug fix for killing thread

parent 8d90eda6
...@@ -368,6 +368,7 @@ void *te_thread(void *param) { ...@@ -368,6 +368,7 @@ void *te_thread(void *param) {
while (!oai_exit) { while (!oai_exit) {
if (wait_on_condition(&tep->mutex_te,&tep->cond_te,&tep->instance_cnt_te,"te thread")<0) break; if (wait_on_condition(&tep->mutex_te,&tep->cond_te,&tep->instance_cnt_te,"te thread")<0) break;
if(oai_exit) break;
dlsch_encoding_2threads0(tep); dlsch_encoding_2threads0(tep);
......
...@@ -428,6 +428,7 @@ void *td_thread(void *param) { ...@@ -428,6 +428,7 @@ void *td_thread(void *param) {
while (!oai_exit) { while (!oai_exit) {
if (wait_on_condition(&proc->mutex_td,&proc->cond_td,&proc->instance_cnt_td,"td thread")<0) break; if (wait_on_condition(&proc->mutex_td,&proc->cond_td,&proc->instance_cnt_td,"td thread")<0) break;
if(oai_exit) break;
((td_params*)param)->ret = ulsch_decoding_data_2thread0((td_params*)param); ((td_params*)param)->ret = ulsch_decoding_data_2thread0((td_params*)param);
......
...@@ -1415,8 +1415,8 @@ void kill_te_thread(PHY_VARS_eNB *eNB) { ...@@ -1415,8 +1415,8 @@ void kill_te_thread(PHY_VARS_eNB *eNB) {
proc->tep[i].instance_cnt_te = 0; proc->tep[i].instance_cnt_te = 0;
pthread_cond_signal(&proc->tep[i].cond_te); pthread_cond_signal(&proc->tep[i].cond_te);
pthread_join(proc->tep[i].pthread_te, NULL); pthread_join(proc->tep[i].pthread_te, NULL);
pthread_mutex_init( &proc->tep[i].mutex_te, NULL); pthread_mutex_destroy( &proc->tep[i].mutex_te);
pthread_cond_init( &proc->tep[i].cond_te, NULL); pthread_cond_destroy( &proc->tep[i].cond_te);
} }
} }
......
...@@ -1040,6 +1040,8 @@ void kill_eNB_proc(int inst) { ...@@ -1040,6 +1040,8 @@ void kill_eNB_proc(int inst) {
for (i=0; i<2; i++) { for (i=0; i<2; i++) {
pthread_mutex_lock(&proc_rxtx[i].mutex_rxtx); pthread_mutex_lock(&proc_rxtx[i].mutex_rxtx);
proc_rxtx[i].instance_cnt_rxtx = 0; proc_rxtx[i].instance_cnt_rxtx = 0;
proc_rxtx[i].pipe_ready = 0;
pthread_cond_signal( &proc_rxtx[i].cond_rxtx );
pthread_mutex_unlock(&proc_rxtx[i].mutex_rxtx); pthread_mutex_unlock(&proc_rxtx[i].mutex_rxtx);
} }
proc->instance_cnt_prach = 0; proc->instance_cnt_prach = 0;
......
...@@ -1901,35 +1901,41 @@ void kill_RU_proc(int inst) ...@@ -1901,35 +1901,41 @@ void kill_RU_proc(int inst)
pthread_mutex_lock(&proc->mutex_FH); pthread_mutex_lock(&proc->mutex_FH);
proc->instance_cnt_FH = 0; proc->instance_cnt_FH = 0;
pthread_mutex_unlock(&proc->mutex_FH);
pthread_cond_signal(&proc->cond_FH); pthread_cond_signal(&proc->cond_FH);
pthread_mutex_unlock(&proc->mutex_FH);
pthread_mutex_lock(&proc->mutex_FH1);
proc->instance_cnt_FH1 = 0;
pthread_cond_signal(&proc->cond_FH1);
pthread_mutex_unlock(&proc->mutex_FH1);
pthread_mutex_lock(&proc->mutex_prach); pthread_mutex_lock(&proc->mutex_prach);
proc->instance_cnt_prach = 0; proc->instance_cnt_prach = 0;
pthread_mutex_unlock(&proc->mutex_prach);
pthread_cond_signal(&proc->cond_prach); pthread_cond_signal(&proc->cond_prach);
pthread_mutex_unlock(&proc->mutex_prach);
#ifdef Rel14 #ifdef Rel14
pthread_mutex_lock(&proc->mutex_prach_br); pthread_mutex_lock(&proc->mutex_prach_br);
proc->instance_cnt_prach_br = 0; proc->instance_cnt_prach_br = 0;
pthread_mutex_unlock(&proc->mutex_prach_br);
pthread_cond_signal(&proc->cond_prach_br); pthread_cond_signal(&proc->cond_prach_br);
pthread_mutex_unlock(&proc->mutex_prach_br);
#endif #endif
pthread_mutex_lock(&proc->mutex_synch); pthread_mutex_lock(&proc->mutex_synch);
proc->instance_cnt_synch = 0; proc->instance_cnt_synch = 0;
pthread_mutex_unlock(&proc->mutex_synch);
pthread_cond_signal(&proc->cond_synch); pthread_cond_signal(&proc->cond_synch);
pthread_mutex_unlock(&proc->mutex_synch);
pthread_mutex_lock(&proc->mutex_eNBs); pthread_mutex_lock(&proc->mutex_eNBs);
proc->ru_tx_ready = 0;
proc->instance_cnt_eNBs = 0; proc->instance_cnt_eNBs = 0;
pthread_mutex_unlock(&proc->mutex_eNBs);
pthread_cond_signal(&proc->cond_eNBs); pthread_cond_signal(&proc->cond_eNBs);
pthread_mutex_unlock(&proc->mutex_eNBs);
pthread_mutex_lock(&proc->mutex_asynch_rxtx); pthread_mutex_lock(&proc->mutex_asynch_rxtx);
proc->instance_cnt_asynch_rxtx = 0; proc->instance_cnt_asynch_rxtx = 0;
pthread_mutex_unlock(&proc->mutex_asynch_rxtx);
pthread_cond_signal(&proc->cond_asynch_rxtx); pthread_cond_signal(&proc->cond_asynch_rxtx);
pthread_mutex_unlock(&proc->mutex_asynch_rxtx);
LOG_D(PHY, "Joining pthread_FH\n"); LOG_D(PHY, "Joining pthread_FH\n");
pthread_join(proc->pthread_FH, NULL); pthread_join(proc->pthread_FH, NULL);
...@@ -1952,7 +1958,7 @@ void kill_RU_proc(int inst) ...@@ -1952,7 +1958,7 @@ void kill_RU_proc(int inst)
pthread_join(proc->pthread_asynch_rxtx, NULL); pthread_join(proc->pthread_asynch_rxtx, NULL);
} }
} }
if (get_nprocs() >= 2) { if (get_nprocs() >= 2 && fepw) {
if (ru->feprx) { if (ru->feprx) {
pthread_mutex_lock(&proc->mutex_fep); pthread_mutex_lock(&proc->mutex_fep);
proc->instance_cnt_fep = 0; proc->instance_cnt_fep = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment