这篇教程C++ CPR_ERROR函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中CPR_ERROR函数的典型用法代码示例。如果您正苦于以下问题:C++ CPR_ERROR函数的具体用法?C++ CPR_ERROR怎么用?C++ CPR_ERROR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了CPR_ERROR函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: cprGetMutex/** * cprGetMutex * * Acquire ownership of a mutex * * Parameters: mutex - Which mutex to acquire * * Return Value: Success or failure indication */cprRC_tcprGetMutex (cprMutex_t mutex){ int32_t rc; static const char fname[] = "cprGetMutex"; cpr_mutex_t *cprMutexPtr; cprMutexPtr = (cpr_mutex_t *) mutex; if (cprMutexPtr != NULL) { /* * Block until mutex is available so this function will * always return success since if it returns we have * gotten the mutex. */ rc = WaitForSingleObject((HANDLE) cprMutexPtr->u.handlePtr, INFINITE); if (rc != WAIT_OBJECT_0) { CPR_ERROR("%s - Error acquiring mutex: %d/n", fname, rc); return (CPR_FAILURE); } return (CPR_SUCCESS); /* Bad application! */ } else { CPR_ERROR("%s - NULL pointer passed in./n", fname); return (CPR_FAILURE); }}
开发者ID:AshishNamdev,项目名称:mozilla-central,代码行数:37,
示例2: cprDestroyThread/** * cprDestroyThread * * @brief Destroys the thread passed in. * * The cprDestroyThread function is called to destroy a thread. The thread * parameter may be any valid thread including the calling thread itself. * * @param[in] thread - thread to destroy. * * @return CPR_SUCCESS or CPR_FAILURE. errno should be set for FAILURE case. * * @note In Linux there will never be a success indication as the * calling thread will have been terminated. */cprRC_tcprDestroyThread (cprThread_t thread){ static const char fname[] = "cprDestroyThread"; cpr_thread_t *cprThreadPtr; cprThreadPtr = (cpr_thread_t *) thread; if (cprThreadPtr != NULL) { /* * Make sure thread is trying to destroy itself. */ if (cprThreadPtr->u.handlePtr == (void*) pthread_self()) { cprThreadPtr->threadId = 0; cpr_free(cprThreadPtr); pthread_exit(NULL); return CPR_SUCCESS; } CPR_ERROR("%s: Thread attempted to destroy another thread, not itself./n", fname); errno = EINVAL; return CPR_FAILURE; } /* Bad application! */ CPR_ERROR("%s - NULL pointer passed in./n", fname); errno = EINVAL; return CPR_FAILURE;}
开发者ID:AshishNamdev,项目名称:mozilla-central,代码行数:44,
示例3: cprUpdateTimer/** * cprUpdateTimer * * @brief Updates the expiration time for a running timer * * The cprUpdateTimer function cancels a previously started timer referenced by * the parameter timer and then restarts the same timer with the duration passed * in. * * @param[in] timer - which timer to update * @param[in] duration - how long before timer expires in milliseconds * * @return CPR_SUCCESS or CPR_FAILURE */cprRC_tcprUpdateTimer (cprTimer_t timer, uint32_t duration){ static const char fname[] = "cprUpdateTimer"; cpr_timer_t *cprTimerPtr; void *timerData; cprTimerPtr = (cpr_timer_t *) timer; if (cprTimerPtr != NULL) { /* Grab data before cancelling timer */ timerData = cprTimerPtr->data; } else { CPR_ERROR("%s - NULL pointer passed in./n", fname); errno = EINVAL; return CPR_FAILURE; } if (cprCancelTimer(timer) == CPR_SUCCESS) { if (cprStartTimer(timer, duration, timerData) == CPR_SUCCESS) { return CPR_SUCCESS; } else { CPR_ERROR("%s - Failed to start timer %s/n", fname, cprTimerPtr->name); return CPR_FAILURE; } } CPR_ERROR("%s - Failed to cancel timer %s/n", fname, cprTimerPtr->name); return CPR_FAILURE;}
开发者ID:JuannyWang,项目名称:gecko-dev,代码行数:44,
示例4: cprIsTimerRunning/** * cprIsTimerRunning * * @brief Determine if a timer is active * * This function determines whether the passed in timer is currently active. The * "timer" parameter is the handle returned from a previous successful call to * cprCreateTimer. * * @param[in] timer - which timer to check * * @return True is timer is active, False otherwise */booleancprIsTimerRunning (cprTimer_t timer){ static const char fname[] = "cprIsTimerRunning"; cpr_timer_t *cprTimerPtr; timerBlk *timerPtr; //CPR_INFO("istimerrunning(): timer=0x%x/n", timer); cprTimerPtr = (cpr_timer_t *) timer; if (cprTimerPtr != NULL) { timerPtr = (timerBlk *) cprTimerPtr->u.handlePtr; if (timerPtr == NULL) { CPR_ERROR("%s - Timer %s has not been initialized./n", fname, cprTimerPtr->name); errno = EINVAL; return FALSE; } if (timerPtr->timerActive) { return TRUE; } } else { /* Bad application! */ CPR_ERROR("%s - NULL pointer passed in./n", fname); errno = EINVAL; } return FALSE;}
开发者ID:JuannyWang,项目名称:gecko-dev,代码行数:43,
示例5: cprDestroyThread/** * cprDestroyThread * * @brief Destroys the thread passed in. * * The cprDestroyThread function is called to destroy a thread. The thread * parameter may be any valid thread including the calling thread itself. * * @param[in] thread - thread to destroy. * * @return CPR_SUCCESS or CPR_FAILURE. errno should be set for FAILURE case. * * @note In Linux there will never be a success indication as the * calling thread will have been terminated. */cprRC_tcprDestroyThread (cprThread_t thread){ cpr_thread_t *cprThreadPtr; cprThreadPtr = (cpr_thread_t *) thread; if (cprThreadPtr) { /* * Make sure thread is trying to destroy itself. */ if ((pthread_t) cprThreadPtr->u.handleInt == pthread_self()) { CPR_INFO("%s: Destroying Thread %d", __FUNCTION__, cprThreadPtr->threadId); pthread_exit(NULL); return CPR_SUCCESS; } CPR_ERROR("%s: Thread attempted to destroy another thread, not itself.", __FUNCTION__); MOZ_ASSERT(PR_FALSE); errno = EINVAL; return CPR_FAILURE; } CPR_ERROR("%s - NULL pointer passed in.", __FUNCTION__); MOZ_ASSERT(PR_FALSE); errno = EINVAL; return CPR_FAILURE;}
开发者ID:multi-sim,项目名称:releases-mozilla-central,代码行数:43,
示例6: cprDestroyTimer/** * cprDestroyTimer * * @brief Destroys a timer. * * This function will cancel the timer and then destroy it. It sets * all links to NULL and then frees the timer block. * * @param[in] timer - which timer to destroy * * @return CPR_SUCCESS or CPR_FAILURE */cprRC_tcprDestroyTimer (cprTimer_t timer){ static const char fname[] = "cprDestroyTimer"; cpr_timer_t *cprTimerPtr; cprRC_t rc; //CPR_INFO("cprDestroyTimer:destroying timer=%x/n", timer); cprTimerPtr = (cpr_timer_t *) timer; if (cprTimerPtr != NULL) { rc = cprCancelTimer(timer); if (rc == CPR_SUCCESS) { cprTimerPtr->cprTimerId = 0; cpr_free(cprTimerPtr->u.handlePtr); cpr_free(cprTimerPtr); return CPR_SUCCESS; } else { CPR_ERROR("%s - Cancel of Timer %s failed./n", fname, cprTimerPtr->name); return CPR_FAILURE; } } /* Bad application! */ CPR_ERROR("%s - NULL pointer passed in./n", fname); errno = EINVAL; return CPR_FAILURE;}
开发者ID:JuannyWang,项目名称:gecko-dev,代码行数:41,
示例7: cprDestroyThread/* * cprDestroyThread * * Destroys the thread passed in. * * Parameters: thread - thread to destroy. * * Return Value: Success or failure indication. * In CNU there will never be a success * indication as the calling thread will * have been terminated. */cprRC_tcprDestroyThread(cprThread_t thread){ cprRC_t retCode = CPR_FAILURE; static const char fname[] = "cprDestroyThread"; cpr_thread_t *cprThreadPtr; cprThreadPtr = (cpr_thread_t*)thread; if (cprThreadPtr != NULL) { CWinThread * pCWinThread; uint32_t result = 0; uint32_t waitrc = WAIT_FAILED; pCWinThread = (CWinThread *)((cpr_thread_t *)thread)->u.handlePtr; if (pCWinThread !=NULL) { result = pCWinThread->PostThreadMessage(WM_CLOSE, 0, 0); if(result) { waitrc = WaitForSingleObject(pCWinThread->m_hThread, 60000); } } if (result == 0) { CPR_ERROR("%s - Thread exit failure %d/n", fname, GetLastError()); retCode = CPR_FAILURE; } retCode = CPR_SUCCESS; /* Bad application! */ } else { CPR_ERROR("%s - NULL pointer passed in./n", fname); retCode = CPR_FAILURE; } cpr_free(cprThreadPtr); return (retCode);};
开发者ID:AsherBond,项目名称:ikran,代码行数:44,
示例8: cprDestroyMutex/** * cprDestroyMutex * * @brief Destroys the mutex passed in. * * The cprDestroyMutex function is called to destroy a mutex. It is the * application's responsibility to ensure that the mutex is unlocked when * destroyed. Unpredictiable behavior will occur if an application * destroys a locked mutex. * * @param[in] mutex - mutex to destroy * * @return CPR_SUCCESS or CPR_FAILURE. errno should be set for CPR_FAILURE. */cprRC_tcprDestroyMutex (cprMutex_t mutex){ static const char fname[] = "cprDestroyMutex"; cpr_mutex_t *cprMutexPtr; int32_t rc; cprMutexPtr = (cpr_mutex_t *) mutex; if (cprMutexPtr != NULL) { rc = pthread_mutex_destroy(cprMutexPtr->u.handlePtr); if (rc != 0) { CPR_ERROR("%s - Failure destroying Mutex %s: %d/n", fname, cprMutexPtr->name, rc); return CPR_FAILURE; } cprMutexPtr->lockId = 0; cpr_free(cprMutexPtr->u.handlePtr); cpr_free(cprMutexPtr); return CPR_SUCCESS; } /* Bad application! */ CPR_ERROR("%s - NULL pointer passed in./n", fname); errno = EINVAL; return CPR_FAILURE;}
开发者ID:AsherBond,项目名称:ikran,代码行数:40,
示例9: cprPreInit/** * 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_tcprPreInit (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;}
开发者ID:Web5design,项目名称:mozilla-central,代码行数:43,
示例10: cprResumeThread/** * cprResumeThread * * Resume execution of a previously suspended thread * * Parameters: thread - which system thread to resume * * Return Value: Success or failure indication */cprRC_tcprResumeThread(cprThread_t thread){ int32_t returnCode; static const char fname[] = "cprResumeThread"; cpr_thread_t *cprThreadPtr; cprThreadPtr = (cpr_thread_t*)thread; if (cprThreadPtr != NULL) { CWinThread *pCWinThread; pCWinThread = (CWinThread *)cprThreadPtr->u.handlePtr; if (pCWinThread != NULL) { returnCode = pCWinThread->ResumeThread(); if (returnCode == -1) { CPR_ERROR("%s - Resume thread failed: %d/n", fname, GetLastError()); return(CPR_FAILURE); } return(CPR_SUCCESS); } /* Bad application! */ } CPR_ERROR("%s - NULL pointer passed in./n", fname); return(CPR_FAILURE);};
开发者ID:AsherBond,项目名称:ikran,代码行数:35,
示例11: addTimerToList/** * addTimerToList * Send message to timer service to add the timer pointed by cprTimerPtr * to the list. This routine is just sending IPC message to timer service * but the actual addition is done by timer service using the addTimer function. * This function is only called by CPR functions and is not visible to external * applications. * @param[in] cprTimerPtr - timer pointer * @param[in] duration - timer duration in msec. * @param[in] data - opaque data * @return - CPR_SUCCESS or CPR_FAILURE */static cprRC_t addTimerToList (cpr_timer_t *cprTimerPtr, uint32_t duration, void *data){ // TODO([email C++ CPUCLOCK_WHICH函数代码示例 C++ CPRINTS函数代码示例
|