Esempio n. 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;
}
Esempio n. 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;
}