/** * cprPreInit * * @brief The cprPreInit function IS called from pSIPCC @b before any components are initialized. * * This function @b SHOULD initialize those portions of the CPR that * are needed before applications can start using it. The memory subsystem * (sandbox) is initialized from this routine. * * * @return CPR_SUCCESS or CPR_FAILURE * @note pSIPCC will NOT continue and stop initialization if the return value is CPR_FAILURE. */ cprRC_t cprPreInit (void) { static const char fname[] = "cprPreInit"; int32_t returnCode; /* * Make function reentreant */ if (pre_init_called == TRUE) { return CPR_SUCCESS; } pre_init_called = TRUE; /* * Create message queue list mutex */ returnCode = pthread_mutex_init(&msgQueueListMutex, NULL); if (returnCode != 0) { CPR_ERROR("%s: MsgQueue Mutex init failure %d\n", fname, returnCode); return CPR_FAILURE; } #if CPR_TIMERS_ENABLED returnCode = cpr_timer_pre_init(); if (returnCode != 0) { CPR_ERROR("%s: timer pre init failed %d\n", fname, returnCode); return CPR_FAILURE; } #endif return CPR_SUCCESS; }
/** * cprPreInit * * @brief The cprPreInit function IS called from pSIPCC @b before any components are initialized. * * This function @b SHOULD initialize those portions of the CPR that * are needed before applications can start using it. The memory subsystem * (sandbox) is initialized from this routine. * * * @return CPR_SUCCESS or CPR_FAILURE * @note pSIPCC will NOT continue and stop initialization if the return value is CPR_FAILURE. */ cprRC_t cprPreInit (void) { static const char fname[] = "cprPreInit"; int32_t returnCode; /* * Make function reentreant */ if (pre_init_called == TRUE) { return CPR_SUCCESS; } pre_init_called = TRUE; /* * Do not move memory pre init below. * This initializes the memory sandbox * and must be first thing done here to make sure * allocations succeed. */ if (cpr_memory_mgmt_pre_init(PRIVATE_SYS_MEM_SIZE) != TRUE) { return CPR_FAILURE; } /* * Create message queue list mutex */ returnCode = pthread_mutex_init(&msgQueueListMutex, NULL); if (returnCode != 0) { CPR_ERROR("%s: MsgQueue Mutex init failure %d\n", fname, returnCode); return CPR_FAILURE; } returnCode = cpr_timer_pre_init(); if (returnCode != 0) { CPR_ERROR("%s: timer pre init failed %d\n", fname, returnCode); return CPR_FAILURE; } return CPR_SUCCESS; }