From eebc9396c1173e9acef086782445133863a955a6 Mon Sep 17 00:00:00 2001
From: navid <navid@mycompany.com>
Date: Wed, 24 Jun 2015 12:50:55 +0000
Subject: [PATCH] LG: wait for using msc if msc not initialized

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@7652 818b1a75-f10b-46b9-bf7c-635c3b92a50f
---
 common/utils/msc/msc.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/common/utils/msc/msc.c b/common/utils/msc/msc.c
index 6429cfb46e7..f242bd898ae 100644
--- a/common/utils/msc/msc.c
+++ b/common/utils/msc/msc.c
@@ -66,8 +66,8 @@ typedef struct msc_queue_item_s {
 } msc_queue_item_t;
 
 msc_message_number_t             g_message_number = 0;
-struct lfds611_queue_state      *g_msc_message_queue_p;
-struct lfds611_stack_state      *g_msc_memory_stack_p;
+struct lfds611_queue_state      *g_msc_message_queue_p = NULL;
+struct lfds611_stack_state      *g_msc_memory_stack_p  = NULL;
 
 //------------------------------------------------------------------------------
 void *msc_task(void *args_p)
@@ -350,6 +350,9 @@ int msc_init(const msc_env_t envP, const int max_threadsP)
 void msc_start_use(void)
 //------------------------------------------------------------------------------
 {
+  while (NULL == g_msc_message_queue_p) {
+    pthread_yield();
+  }
   lfds611_queue_use(g_msc_message_queue_p);
   lfds611_stack_use(g_msc_memory_stack_p);
 }
-- 
GitLab