From 362e7c1403c33033b974ace2f903996bf31fe67b Mon Sep 17 00:00:00 2001
From: khadraou <younes.khadraoui@eurecom.fr>
Date: Wed, 13 Dec 2017 16:38:28 +0100
Subject: [PATCH] bugfix

---
 targets/RT/USER/lte-ru.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/targets/RT/USER/lte-ru.c b/targets/RT/USER/lte-ru.c
index b87277dfb22..e75bf5b2583 100644
--- a/targets/RT/USER/lte-ru.c
+++ b/targets/RT/USER/lte-ru.c
@@ -1447,15 +1447,6 @@ static void* ru_thread_control( void* param ) {
   }
   if (ru->if_south != LOCAL_RF) wait_eNBs();
 
-
-  LOG_I(PHY, "Signaling main thread that RU %d is ready\n",ru->idx);
-  pthread_mutex_lock(&RC.ru_mutex);
-  RC.ru_mask &= ~(1<<ru->idx);
-  pthread_cond_signal(&RC.ru_cond);
-  pthread_mutex_unlock(&RC.ru_mutex);
-  
-  wait_sync("ru_thread");
-
   
   ru->state = RU_IDLE;
   LOG_I(PHY,"Control channel ON for RU %d\n", ru->idx);
@@ -1576,6 +1567,14 @@ static void* ru_thread_control( void* param ) {
 						exit_fun( "ERROR pthread_cond_signal" );
 						break;
 					}
+
+  					  LOG_I(PHY, "Signaling main thread that RU %d is ready\n",ru->idx);
+					  pthread_mutex_lock(&RC.ru_mutex);
+					  RC.ru_mask &= ~(1<<ru->idx);
+					  pthread_cond_signal(&RC.ru_cond);
+					  pthread_mutex_unlock(&RC.ru_mutex);
+					  
+					  wait_sync("ru_thread");
 				}		
 				break;
 
-- 
GitLab