mirror of https://github.com/PentHertz/srsLTE.git
Wait to stop ENB/PHY worker
This commit is contained in:
parent
2b9105791c
commit
3c276e7ae3
|
@ -133,7 +133,8 @@ private:
|
||||||
std::map<uint16_t,ue> ue_db;
|
std::map<uint16_t,ue> ue_db;
|
||||||
|
|
||||||
// mutex to protect worker_imp() from configuration interface
|
// mutex to protect worker_imp() from configuration interface
|
||||||
pthread_mutex_t mutex;
|
pthread_mutex_t mutex;
|
||||||
|
bool is_worker_running;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace srsenb
|
} // namespace srsenb
|
||||||
|
|
|
@ -166,19 +166,30 @@ void phch_worker::stop()
|
||||||
{
|
{
|
||||||
running = false;
|
running = false;
|
||||||
pthread_mutex_lock(&mutex);
|
pthread_mutex_lock(&mutex);
|
||||||
srslte_softbuffer_tx_free(&temp_mbsfn_softbuffer);
|
|
||||||
srslte_enb_dl_free(&enb_dl);
|
int cnt = 0;
|
||||||
srslte_enb_ul_free(&enb_ul);
|
while(is_worker_running && cnt<100) {
|
||||||
for (int p = 0; p < SRSLTE_MAX_PORTS; p++) {
|
usleep(1000);
|
||||||
if (signal_buffer_rx[p]) {
|
cnt++;
|
||||||
free(signal_buffer_rx[p]);
|
}
|
||||||
}
|
|
||||||
if (signal_buffer_tx[p]) {
|
if (!is_worker_running) {
|
||||||
free(signal_buffer_tx[p]);
|
srslte_softbuffer_tx_free(&temp_mbsfn_softbuffer);
|
||||||
}
|
srslte_enb_dl_free(&enb_dl);
|
||||||
|
srslte_enb_ul_free(&enb_ul);
|
||||||
|
for (int p = 0; p < SRSLTE_MAX_PORTS; p++) {
|
||||||
|
if (signal_buffer_rx[p]) {
|
||||||
|
free(signal_buffer_rx[p]);
|
||||||
|
}
|
||||||
|
if (signal_buffer_tx[p]) {
|
||||||
|
free(signal_buffer_tx[p]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pthread_mutex_unlock(&mutex);
|
||||||
|
pthread_mutex_destroy(&mutex);
|
||||||
|
} else {
|
||||||
|
printf("Warning could not stop properly PHY\n");
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&mutex);
|
|
||||||
pthread_mutex_destroy(&mutex);
|
|
||||||
}
|
}
|
||||||
void phch_worker::reset()
|
void phch_worker::reset()
|
||||||
{
|
{
|
||||||
|
@ -355,8 +366,6 @@ void phch_worker::rem_rnti(uint16_t rnti)
|
||||||
|
|
||||||
void phch_worker::work_imp()
|
void phch_worker::work_imp()
|
||||||
{
|
{
|
||||||
bool is_mutexed;
|
|
||||||
|
|
||||||
if (!running) {
|
if (!running) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -364,7 +373,7 @@ void phch_worker::work_imp()
|
||||||
subframe_cfg_t sf_cfg;
|
subframe_cfg_t sf_cfg;
|
||||||
phy->get_sf_config(&sf_cfg, tti_tx_dl);// TODO difference between tti_tx_dl and t_tx_dl
|
phy->get_sf_config(&sf_cfg, tti_tx_dl);// TODO difference between tti_tx_dl and t_tx_dl
|
||||||
pthread_mutex_lock(&mutex);
|
pthread_mutex_lock(&mutex);
|
||||||
is_mutexed = true;
|
is_worker_running = true;
|
||||||
|
|
||||||
mac_interface_phy::ul_sched_t *ul_grants = phy->ul_grants;
|
mac_interface_phy::ul_sched_t *ul_grants = phy->ul_grants;
|
||||||
mac_interface_phy::dl_sched_t *dl_grants = phy->dl_grants;
|
mac_interface_phy::dl_sched_t *dl_grants = phy->dl_grants;
|
||||||
|
@ -459,18 +468,20 @@ void phch_worker::work_imp()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
is_mutexed = false;
|
|
||||||
pthread_mutex_unlock(&mutex);
|
|
||||||
|
|
||||||
// Generate signal and transmit
|
// Generate signal and transmit
|
||||||
if(sf_cfg.sf_type == SUBFRAME_TYPE_REGULAR) {
|
if(sf_cfg.sf_type == SUBFRAME_TYPE_REGULAR) {
|
||||||
srslte_enb_dl_gen_signal(&enb_dl);
|
srslte_enb_dl_gen_signal(&enb_dl);
|
||||||
} else {
|
} else {
|
||||||
srslte_enb_dl_gen_signal_mbsfn(&enb_dl);
|
srslte_enb_dl_gen_signal_mbsfn(&enb_dl);
|
||||||
}
|
}
|
||||||
Debug("Sending to radio\n");
|
|
||||||
|
pthread_mutex_unlock(&mutex);
|
||||||
|
|
||||||
|
Debug("Sending to radio\n");
|
||||||
phy->worker_end(tx_mutex_cnt, signal_buffer_tx, SRSLTE_SF_LEN_PRB(phy->cell.nof_prb), tx_time);
|
phy->worker_end(tx_mutex_cnt, signal_buffer_tx, SRSLTE_SF_LEN_PRB(phy->cell.nof_prb), tx_time);
|
||||||
|
|
||||||
|
is_worker_running = false;
|
||||||
|
|
||||||
#ifdef DEBUG_WRITE_FILE
|
#ifdef DEBUG_WRITE_FILE
|
||||||
fwrite(signal_buffer_tx, SRSLTE_SF_LEN_PRB(phy->cell.nof_prb)*sizeof(cf_t), 1, f);
|
fwrite(signal_buffer_tx, SRSLTE_SF_LEN_PRB(phy->cell.nof_prb)*sizeof(cf_t), 1, f);
|
||||||
#endif
|
#endif
|
||||||
|
@ -490,7 +501,8 @@ void phch_worker::work_imp()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
unlock:
|
unlock:
|
||||||
if (is_mutexed) {
|
if (is_worker_running) {
|
||||||
|
is_worker_running = false;
|
||||||
pthread_mutex_unlock(&mutex);
|
pthread_mutex_unlock(&mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue