summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsung.goo.kim <sung.goo.kim@samsung.com>2016-03-14 10:14:21 +0900
committersung.goo.kim <sung.goo.kim@samsung.com>2016-03-14 10:15:26 +0900
commit1200911b5086818e9ece03e1228de80e75b768e1 (patch)
tree066ac928c6772fe6e7b990b85263672474ad07fc
parent263dfe154b215f527bea979aaa5fca941483b67a (diff)
downloadiotivity-1200911b5086818e9ece03e1228de80e75b768e1.tar.gz
iotivity-1200911b5086818e9ece03e1228de80e75b768e1.tar.bz2
iotivity-1200911b5086818e9ece03e1228de80e75b768e1.zip
Revert "Remove default g_mainloop creation code on tizen"
This reverts commit 2b5e7007b4ce8360a0fe3f1ca2a306aeea82ca71. Change-Id: I772036fa9b62d3feabf8904fcc16a482910cbb17
-rw-r--r--resource/csdk/connectivity/src/bt_edr_adapter/tizen/caedrnwmonitor.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/resource/csdk/connectivity/src/bt_edr_adapter/tizen/caedrnwmonitor.c b/resource/csdk/connectivity/src/bt_edr_adapter/tizen/caedrnwmonitor.c
index 0c2bb6adb..dd3e11d95 100644
--- a/resource/csdk/connectivity/src/bt_edr_adapter/tizen/caedrnwmonitor.c
+++ b/resource/csdk/connectivity/src/bt_edr_adapter/tizen/caedrnwmonitor.c
@@ -35,6 +35,7 @@
#include "caqueueingthread.h"
#include "caremotehandler.h"
+static GMainLoop *g_mainloop = NULL;
static ca_thread_pool_t g_threadPoolHandle = NULL;
/**
@@ -49,6 +50,13 @@ static CAEDRNetworkStatusCallback g_edrNetworkChangeCallback = NULL;
*/
static void CAEDRAdapterStateChangeCallback(int result, bt_adapter_state_e adapterState,
void *userData);
+
+void *GMainLoopThread (void *param)
+{
+ g_main_loop_run(g_mainloop);
+ return NULL;
+}
+
CAResult_t CAEDRInitializeNetworkMonitor(const ca_thread_pool_t threadPool)
{
OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN");
@@ -73,6 +81,19 @@ CAResult_t CAEDRStartNetworkMonitor()
{
OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN");
+ g_mainloop = g_main_loop_new(NULL, 0);
+ if(!g_mainloop)
+ {
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "g_main_loop_new failed\n");
+ return CA_STATUS_FAILED;
+ }
+
+ if (CA_STATUS_OK != ca_thread_pool_add_task(g_threadPoolHandle, GMainLoopThread, (void *) NULL))
+ {
+ OIC_LOG(ERROR, EDR_ADAPTER_TAG, "Failed to create thread!");
+ return CA_STATUS_FAILED;
+ }
+
// Initialize Bluetooth service
int err = bt_initialize();
if (BT_ERROR_NONE != err)
@@ -103,6 +124,11 @@ CAResult_t CAEDRStopNetworkMonitor()
OIC_LOG(ERROR, EDR_ADAPTER_TAG, "bt_adapter_set_state_changed_cb failed");
return CA_STATUS_FAILED;
}
+
+ if (g_mainloop)
+ {
+ g_main_loop_quit(g_mainloop);
+ }
OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "OUT");
return CA_STATUS_OK;
}