[Internal: merge sync-agent]
[platform/core/system/sync-agent.git] / src / framework / utility / fw_mainloop.c
index 4072888..f0d9d01 100755 (executable)
@@ -74,7 +74,14 @@ EXPORT_API void sync_agent_run_main_loop(int use_thread)
                        pthread_cond_init(&loop_cond, NULL);    /* TODO : error handling  if return value is not 0, fail logic */
 
                        pthread_mutex_lock(&loop_mutex);
-                       pthread_create(&main_loop_thread_id, 0, _main_loop_rutine, 0);
+                       int status_thread_create = 0;
+                       status_thread_create = pthread_create(&main_loop_thread_id, 0, _main_loop_rutine, 0);
+                       if(status_thread_create != 0) {
+                               _DEBUG_WARNING("pthread_create [%d]", status_thread_create );
+                               pthread_mutex_unlock(&loop_mutex);
+                               _EXTERN_FUNC_EXIT;
+                               return;
+                       }                       
                        do {
                                pthread_cond_wait(&loop_cond, &loop_mutex);
                        } while (loop == NULL);