[IOT-2912] randompin 85/23485/3
authorOleksandr Dmytrenko <o.dmytrenko@samsung.com>
Tue, 28 Nov 2017 10:06:17 +0000 (12:06 +0200)
committerRandeep Singh <randeep.s@samsung.com>
Tue, 2 Jan 2018 05:45:40 +0000 (05:45 +0000)
sample randompin server refactoring

Bug: https://jira.iotivity.org/browse/IOT-2912
Change-Id: I4aa744a34d706a995fb8d4d7d2927ff29a2ec39a
Signed-off-by: Oleksandr Dmytrenko <o.dmytrenko@samsung.com>
resource/csdk/security/provisioning/sample/sampleserver_randompin.cpp

index 26914a2..aaea020 100644 (file)
@@ -150,7 +150,7 @@ const char *getResult(OCStackResult result) {
 #include <chrono>
 
 static bool volatile g_LoopFlag;
-static std::thread* oc_process_thread;
+static std::thread* oc_process_thread = nullptr;
 
 static void oc_process_loop()
 {
@@ -170,6 +170,11 @@ static void StartOCProcessThread()
 {
     g_LoopFlag = true;
     oc_process_thread = new std::thread(oc_process_loop);
+    if(nullptr == oc_process_thread)
+    {
+        OIC_LOG_V(ERROR, TAG, "%s start thread mail loop returns null, exit.", __func__);
+        ::exit(1);
+    }
 }
 
 static void StopOCProcessThread()