framework/src/st_things/things_stack/things_stack.c
//----------------------------------------------------------------------------------
/**
 * definition of API for stop things stack.
 */
definition of API for stop things stack.
definition of API for stop things stack .
int things_stop_stack(void)
{
	THINGS_LOG_D(TAG, THINGS_FUNC_ENTRY);
	pthread_mutex_lock(&g_things_stop_mutex);
	pthread_mutex_lock(&m_thread_oic_reset);
	if (b_thread_things_reset == true) {
		b_reset_continue_flag = false;
		pthread_join(h_thread_things_reset, NULL);
		pthread_detach(h_thread_things_reset);
		h_thread_things_reset = 0;
		b_thread_things_reset = false;
	}
	pthread_mutex_unlock(&m_thread_oic_reset);
	THINGS_LOG_D(TAG, "Terminate Cloud Session Managing");
	es_cloud_terminate();
	THINGS_LOG_D(TAG, "Terminate EasySetup");
	esm_terminate_easysetup();
#ifdef __SECURED__
	THINGS_LOG_D(TAG, "Terminate OIC Security Manager");
#endif
	if (g_server_builder != NULL) {
		release_builder_instance(g_server_builder);
		g_server_builder = NULL;
	}
	if (g_req_handler != NULL) {
		g_req_handler->deinit_module();
		release_handler_instance(g_req_handler);
		g_req_handler = NULL;
	}
	dm_termiate_module();
	THINGS_LOG_D(TAG, THINGS_FUNC_EXIT);
	pthread_mutex_unlock(&g_things_stop_mutex);
	return 1;
}
int things_stop_stack ( void ) { THINGS_LOG_D ( TAG , THINGS_FUNC_ENTRY ) ; pthread_mutex_lock ( & g_things_stop_mutex ) ; pthread_mutex_lock ( & m_thread_oic_reset ) ; if ( b_thread_things_reset == true ) { b_reset_continue_flag = false ; pthread_join ( h_thread_things_reset , NULL ) ; pthread_detach ( h_thread_things_reset ) ; h_thread_things_reset = 0 ; b_thread_things_reset = false ; } pthread_mutex_unlock ( & m_thread_oic_reset ) ; THINGS_LOG_D ( TAG , " " ) ; es_cloud_terminate ( ) ; THINGS_LOG_D ( TAG , " " ) ; esm_terminate_easysetup ( ) ; #ifdef __SECURED__ THINGS_LOG_D ( TAG , " " ) ; #endif if ( g_server_builder != NULL ) { release_builder_instance ( g_server_builder ) ; g_server_builder = NULL ; } if ( g_req_handler != NULL ) { g_req_handler -> deinit_module ( ) ; release_handler_instance ( g_req_handler ) ; g_req_handler = NULL ; } dm_termiate_module ( ) ; THINGS_LOG_D ( TAG , THINGS_FUNC_EXIT ) ; pthread_mutex_unlock ( & g_things_stop_mutex ) ; return 1 ; }
definition of API for stop things stack.
definition of API for stop things stack .
// Terminate cloud connection. // Terminate easysetup. // [Jay] Need to add memory release for the Queue..