static ca_thread_pool_t g_threadPool = NULL;
/**
+ * Thread task id.
+ */
+static uint32_t g_taskId = 0;
+
+/**
* Mutex to synchronize device object list.
*/
static oc_mutex g_mutexObjectList = NULL;
CAResult_t res = CA_STATUS_OK;
#ifndef __TIZENRT__
- res = ca_thread_pool_add_task(g_threadPool, CAReceiveHandler, NULL, NULL);
+ res = ca_thread_pool_add_task(g_threadPool, CAReceiveHandler, NULL, &g_taskId);
#else
res = ca_thread_pool_add_task(g_threadPool, CAReceiveHandler, NULL, NULL,
"IoT_TCPReceive", CONFIG_IOTIVITY_TCPRECEIVE_PTHREAD_STACKSIZE);
#endif
oc_mutex_unlock(g_mutexObjectList);
+#ifndef __TIZENRT__
+ ca_thread_pool_remove_task(g_threadPool, g_taskId);
+#endif
+
CATCPDisconnectAll();
sleep(1);
-
OIC_LOG(INFO, TAG, "Adapter terminated successfully");
}