Example #1
0
xme_status_t
xme_core_exec_dispatcher_fini( void )
{
    /**
     *     odo should stop all tasks before completing; monitor this case better
     *          there are some stochastic problems in RACE
     */

    XME_LOG(XME_LOG_DEBUG, MODULE_ACRONYM "terminating all tasks...\n");

    /* Terminate all registered tasks */
    if(XME_STATUS_SUCCESS != xme_core_exec_descriptorTable_forEach(terminationCallback))
        XME_LOG(XME_LOG_ERROR, MODULE_ACRONYM "error terminating functions\n");

#ifdef TMP_FINI_SLEEP
    xme_hal_sleep_sleep(((xme_hal_time_timeInterval_t)1000)*1000*10); // 10 ms
#endif

    XME_LOG(XME_LOG_DEBUG, MODULE_ACRONYM "terminated.\n");
#ifndef TMP_FINI_NODESTRUCT
    /* Unlock the resource before destroying it */
    xme_core_exec_unlockMutex("CPU/m", cpuToken, (xme_core_component_t)0, (xme_core_component_functionId_t)0);

    /* Destroy the resource representation */
    if(XME_STATUS_SUCCESS != xme_hal_sync_destroyCriticalSection(cpuToken))
        XME_LOG(XME_LOG_ERROR, MODULE_ACRONYM "error destroying mutex representing CPU resource\n");
    cpuToken = XME_HAL_SYNC_INVALID_CRITICAL_SECTION_HANDLE;

    /* Clean the descriptor table */
    XME_LOG(XME_LOG_DEBUG, MODULE_ACRONYM "finalizing descriptor table.\n");
    XME_CHECK(XME_STATUS_SUCCESS == xme_core_exec_descriptorTable_fini(),
                  XME_STATUS_INTERNAL_ERROR);
#endif
    return XME_STATUS_SUCCESS;
}
Example #2
0
xme_status_t
xme_core_exec_dispatcher_fini( void )
{
    /**
     *     odo should stop all tasks before completing; monitor this case better
     *          there are some stochastic problems in RACE
     */

    XME_LOG(XME_LOG_DEBUG, MODULE_ACRONYM "terminating all tasks...\n");

    /* Terminate all registered tasks */
    if(XME_STATUS_SUCCESS != xme_core_exec_descriptorTable_forEach(terminationCallback))
        XME_LOG(XME_LOG_ERROR, MODULE_ACRONYM "error terminating functions\n");

    XME_LOG(XME_LOG_DEBUG, MODULE_ACRONYM "terminated.\n");

    /* Destroy the resource representation */
    if(XME_STATUS_SUCCESS != xme_hal_sync_destroyCriticalSection(cpuToken))
        XME_LOG(XME_LOG_ERROR, MODULE_ACRONYM "error destroying mutex representing CPU resource\n");
    cpuToken = XME_HAL_SYNC_INVALID_CRITICAL_SECTION_HANDLE;

    /* Clean the descriptor table */
    XME_LOG(XME_LOG_DEBUG, MODULE_ACRONYM "finalizing descriptor table. \n");
    XME_CHECK(XME_STATUS_SUCCESS == xme_core_exec_descriptorTable_fini(),
                  XME_STATUS_INTERNAL_ERROR);
    return XME_STATUS_SUCCESS;
}
Example #3
0
void
configuratorExtension_adv_pnpControlUI_pnpControlUIFunction_fini
(
    configuratorExtension_adv_pnpControlUI_pnpControlUIComponent_config_t* const componentConfig
)
{
    // PROTECTED REGION ID(CONFIGURATOREXTENSION_ADV_PNPCONTROLUI_PNPCONTROLUIFUNCTION_TERMINATE_C) ENABLED START
    
    // TODO: Actually we need to cancel the thread (not supported by xme_hal_sched), as it has a blocking call and might never return!
    xme_hal_sched_removeTask(userInputTaskHandle);

    XME_UNUSED_PARAMETER(componentConfig);

    {
        xme_hal_linkedList_index_t queueItemCount;
        xme_hal_linkedList_index_t i;

        queueItemCount = xme_hal_singlyLinkedList_getItemCount(&commandQueue);

        for (i = 0; i < queueItemCount; i++)
        {
            void* item = xme_hal_singlyLinkedList_itemFromIndex(&commandQueue, i);
            if (NULL != item) { xme_hal_mem_free(item); }
        }

        XME_HAL_SINGLYLINKEDLIST_FINI(commandQueue);
    }

    xme_hal_sync_destroyCriticalSection(commandQueueMutex);
    
    // PROTECTED REGION END
}
/*--------------------------------------------------------------------------*/
xme_status_t
xme_core_exec_descriptorTable_fini( void )
{
    xme_hal_sync_enterCriticalSection(taskDescriptorsMutex);
    XME_HAL_TABLE_FINI(taskDescriptorsTable);
    xme_hal_sync_leaveCriticalSection(taskDescriptorsMutex);

    if(XME_STATUS_SUCCESS != xme_hal_sync_destroyCriticalSection(taskDescriptorsMutex))
        XME_LOG(XME_LOG_ERROR, MODULE_ACRONYM "could not destroy task descriptor table mutex!\n");
    return XME_STATUS_SUCCESS;

}
Example #5
0
void
xme_hal_graphviz_fini(void)
{
	if (0 < xme_hal_graphviz_initializationCount)
	{
		xme_hal_graphviz_initializationCount--;

		if (0 == xme_hal_graphviz_initializationCount)
		{
			//Finalize graphviz
			xme_hal_sync_destroyCriticalSection(xme_hal_graphviz_mutex);
			xme_hal_graphviz_gvc = NULL;
		}
	}
}