From 730ffc76f4009b8164e17e959ccdf639e3b5631c Mon Sep 17 00:00:00 2001
From: Robert Schmidt <robert.schmidt@eurecom.fr>
Date: Tue, 12 Dec 2017 17:00:43 +0100
Subject: [PATCH] stop_L1L2(): no sleep, better oai_exit handling

---
 targets/RT/USER/lte-softmodem.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c
index b89c82aff4..f881441cdb 100644
--- a/targets/RT/USER/lte-softmodem.c
+++ b/targets/RT/USER/lte-softmodem.c
@@ -1504,6 +1504,7 @@ int stop_L1L2(int enb_id)
   int CC_id;
 
   LOG_W(ENB_APP, "stopping lte-softmodem\n");
+  oai_exit = 1;
 
   /* stop trx devices */
   for(CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
@@ -1520,11 +1521,9 @@ int stop_L1L2(int enb_id)
   /* these tasks need to pick up new configuration */
   terminate_task(TASK_RRC_ENB, enb_id);
   terminate_task(TASK_L2L1, enb_id);
-  oai_exit = 1;
   LOG_W(ENB_APP, "calling kill_eNB_proc() for instance %d\n", enb_id);
   kill_eNB_proc(enb_id);
-  /* give some time for all threads */
-  sleep(1);
+  oai_exit = 0;
   return 0;
 }
 
@@ -1546,7 +1545,6 @@ int restart_L1L2(int enb_id)
 
   /* block threads */
   sync_var = -1;
-  oai_exit = 0;
 
   reconfigure_enb_params(enb_id);     /* set frame parameters from configuration */
 
-- 
GitLab