static ClRcT clMsgEventInitTimerStart(void) { ClRcT rc; ClTimerTimeOutT timeout = {CL_MSG_EVT_UP_CHECK_PERIODE, 0}; rc = clTimerCreateAndStart(timeout, CL_TIMER_ONE_SHOT, CL_TIMER_SEPARATE_CONTEXT, clMsgEventInitTimerThread, NULL, &gMsgEvtTimerHdl); if(rc != CL_OK) clLogError("FIN", "BLOCK", "Failed to create and start event inti timer. error code [0x%x].", rc); return rc; }
static ClRcT clLogFlusherCookieHandleCreate(ClUint32T numRecords, ClTimerHandleT *phTimer, ClHandleT *phFlusher) { ClRcT rc = CL_OK; ClLogFlushCookieT *pFlushCookie = NULL; ClLogSvrEoDataT *pSvrEoEntry = NULL; ClTimerTimeOutT timeout = {0, 8000L}; ClHandleT *pTimerArg = NULL; CL_LOG_DEBUG_TRACE(("Enter")); rc = clLogSvrEoEntryGet(&pSvrEoEntry, NULL); if( CL_OK != rc ) { return rc; } if( CL_FALSE == pSvrEoEntry->logInit ) { clLogError("LOG", "FLS", "Log Service has terminated..."); return CL_OK; } CL_LOG_DEBUG_TRACE(("hFlusherDB: %p ", (ClPtrT) pSvrEoEntry->hFlusherDB)); rc = clHandleCreate(pSvrEoEntry->hFlusherDB, sizeof(ClLogFlushCookieT), phFlusher); if( CL_OK != rc ) { clLogError("LOG", "FLS", "clHandleCreate(): rc[0x %x]", rc); return rc; } pTimerArg = (ClHandleT*) clHeapCalloc(1, sizeof(ClHandleT)); if( NULL == pTimerArg ) { clLogError("LOG", "FLS", "clHeapCalloc() : rc[0x %x]", rc); CL_LOG_CLEANUP(clHandleDestroy(pSvrEoEntry->hFlusherDB, *phFlusher), CL_OK); return CL_LOG_RC(CL_ERR_NO_MEMORY); } *pTimerArg = *phFlusher; rc = clTimerCreateAndStart(timeout, CL_TIMER_ONE_SHOT, CL_TIMER_SEPARATE_CONTEXT, clLogFlusherTimerCallback, (ClPtrT)(ClWordT) pTimerArg, phTimer); if( CL_OK != rc ) { clLogError("LOG", "FLS", "clTimerCreate(): rc[0x %x]", rc); CL_LOG_CLEANUP(clHandleDestroy(pSvrEoEntry->hFlusherDB, *phFlusher), CL_OK); clHeapFree(pTimerArg); return rc; } rc = clHandleCheckout(pSvrEoEntry->hFlusherDB, *phFlusher, (void **) &pFlushCookie); if( CL_OK != rc ) { clLogError("LOG", "FLS", "clHandleCheckout(): rc[0x %x]", rc); CL_LOG_CLEANUP(clTimerDelete(phTimer), CL_OK); CL_LOG_CLEANUP(clHandleDestroy(pSvrEoEntry->hFlusherDB, *phFlusher), CL_OK); return rc; } pFlushCookie->numRecords = numRecords; pFlushCookie->hTimer = *phTimer; rc = clHandleCheckin(pSvrEoEntry->hFlusherDB, *phFlusher); if( CL_OK != rc ) { clLogError("LOG", "FLS", "clHandleCheckin(): rc[0x %x]", rc); CL_LOG_CLEANUP(clTimerDelete(phTimer), CL_OK); CL_LOG_CLEANUP(clHandleDestroy(pSvrEoEntry->hFlusherDB, *phFlusher), CL_OK); } CL_LOG_DEBUG_TRACE(("Exit")); return rc; }