本文整理汇总了C++中clOsalMutexLock函数的典型用法代码示例。如果您正苦于以下问题:C++ clOsalMutexLock函数的具体用法?C++ clOsalMutexLock怎么用?C++ clOsalMutexLock使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了clOsalMutexLock函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cpmClusterTrackCallBack
void cpmClusterTrackCallBack(ClGmsHandleT handle, const ClGmsClusterNotificationBufferT *clusterNotificationBuffer, ClUint32T nMembers, ClRcT rc)
{
clLogMultiline(CL_LOG_SEV_DEBUG, CPM_LOG_AREA_CPM, CPM_LOG_CTX_CPM_GMS,
"Received cluster track callback from GMS on node [%s] -- \n"
"Leader : [%d] \n"
"Deputy : [%d] (-1 -> No deputy) \n"
"Leader changed ? [%s] \n"
"Number of nodes in callback : [%d]",
gpClCpm->pCpmLocalInfo->nodeName,
clusterNotificationBuffer->leader,
clusterNotificationBuffer->deputy,
clusterNotificationBuffer->leadershipChanged ? "Yes" : "No",
clusterNotificationBuffer->numberOfItems);
clOsalMutexLock(&gpClCpm->cpmGmsMutex);
gpClCpm->trackCallbackInProgress = CL_TRUE;
clOsalMutexUnlock(&gpClCpm->cpmGmsMutex);
cpmHandleGroupInformation(clusterNotificationBuffer);
rc = clOsalMutexLock(&gpClCpm->cpmGmsMutex);
gpClCpm->trackCallbackInProgress = CL_FALSE;
CL_CPM_CHECK_1(CL_LOG_SEV_ERROR, CL_CPM_LOG_1_OSAL_MUTEX_LOCK_ERR, rc, rc,
CL_LOG_HANDLE_APP);
rc = clOsalCondSignal(&gpClCpm->cpmGmsCondVar);
CL_CPM_CHECK_1(CL_LOG_SEV_ERROR, CL_CPM_LOG_1_OSAL_COND_SIGNAL_ERR, rc, rc,
CL_LOG_HANDLE_APP);
rc = clOsalMutexUnlock(&gpClCpm->cpmGmsMutex);
CL_CPM_CHECK_1(CL_LOG_SEV_ERROR, CL_CPM_LOG_1_OSAL_MUTEX_UNLOCK_ERR, rc, rc,
CL_LOG_HANDLE_APP);
failure:
return;
}
开发者ID:mrv-communications-pilot,项目名称:SAFplus-Availability-Scalability-Platform,代码行数:32,代码来源:clCpmGms.c
示例2: clAlarmPayloadCntDelete
/*
* This api would be called as and when the object is no more and the corresponding entry
* within the container needs to be deleted.
*/
ClRcT clAlarmPayloadCntDelete(ClCorMOIdPtrT pMoId, ClAlarmProbableCauseT probCause, ClAlarmSpecificProblemT specificProblem)
{
ClRcT rc = CL_OK;
ClCntNodeHandleT nodeH;
ClAlarmPayloadCntKeyT *pCntKey = clHeapAllocate(sizeof(ClAlarmPayloadCntKeyT));
if(NULL == pCntKey)
{
CL_DEBUG_PRINT (CL_DEBUG_CRITICAL,("Memory allocation failed with rc 0x%x ", rc));
return (rc);
}
pCntKey->probCause = probCause;
pCntKey->specificProblem = specificProblem;
pCntKey->moId = *pMoId;
clOsalMutexLock(gClAlarmPayloadCntMutex);
rc = clCntNodeFind(gPayloadCntHandle,(ClCntKeyHandleT)pCntKey,&nodeH);
if(CL_OK == rc)
{
rc = clCntAllNodesForKeyDelete(gPayloadCntHandle,(ClCntKeyHandleT)pCntKey);
if (CL_OK != rc)
{
CL_DEBUG_PRINT(CL_DEBUG_ERROR, ("clCntAllNodesForKeyDelete failed w rc:0x%x\n", rc));
}
}
else
{
CL_DEBUG_PRINT(CL_DEBUG_ERROR, ("Node does not exist with rc:0x%x\n", rc));
}
clHeapFree(pCntKey);
clOsalMutexUnlock(gClAlarmPayloadCntMutex);
return rc;
}
开发者ID:NguyenHoangOC,项目名称:SAFplus-Availability-Scalability-Platform,代码行数:36,代码来源:clAlarmPayloadCont.c
示例3: tsAllActiveTimersPrint
void
tsAllActiveTimersPrint (void)
{
ClRcT returnCode = CL_ERR_INVALID_HANDLE;
ClUint32T count = 0;
TsTimer_t* pUserTimer = NULL;
returnCode = clOsalMutexLock (gActiveTimerQueue.timerMutex);
if (returnCode != CL_OK) {
return;
}
if (gActiveTimerQueue.pFirstTimer == NULL) {
/* no elements to display */
returnCode = clOsalMutexUnlock (gActiveTimerQueue.timerMutex);
return;
}
for (pUserTimer = gActiveTimerQueue.pFirstTimer, count = 0;
pUserTimer != NULL;
pUserTimer = pUserTimer->pNextActiveTimer, count++) {
clOsalPrintf ("(%d) Timer timeout = %us, timestamp->sec = %ld, timestamp->Microsec = %ld.\n",
(ClInt32T)count,
pUserTimer->timeOut.tsSec,
pUserTimer->timestamp/1000000ULL,
pUserTimer->timestamp%1000000ULL);
}
returnCode = clOsalMutexUnlock (gActiveTimerQueue.timerMutex);
}
示例4: clEoClientCallbackDbFinalize
ClRcT clEoClientCallbackDbFinalize(void)
{
ClRcT rc;
ClUint32T i;
rc = clOsalMutexLock(&gpCallbackDb.lock);
if(rc != CL_OK)
{
/* Print a message here */
return rc;
}
for(i = 0 ; i < gpCallbackDb.numRecs; i++)
{
if(gpCallbackDb.pDb[i] != NULL)
clHeapFree(gpCallbackDb.pDb[i]);
}
clHeapFree(gpCallbackDb.pDb);
gpCallbackDb.numRecs = 0;
clOsalMutexUnlock(&gpCallbackDb.lock);
return CL_OK;
}
示例5: clBitmap2BufferGet
ClRcT
clBitmap2BufferGet(ClBitmapHandleT hBitmap,
ClUint32T *pListLen,
ClUint8T **ppPositionList)
{
ClBitmapInfoT *pBitmapInfo = hBitmap;
ClRcT rc = CL_OK;
if( CL_BM_INVALID_BITMAP_HANDLE == hBitmap )
{
CL_DEBUG_PRINT(CL_DEBUG_ERROR, ("Invalid Handle"));
return CL_BITMAP_RC(CL_ERR_INVALID_HANDLE);
}
rc = clOsalMutexLock(pBitmapInfo->bitmapLock);
if( CL_OK != rc )
{
CL_DEBUG_PRINT(CL_DEBUG_ERROR, ("clOsalMutexLock() rc: %x", rc));
return rc;
}
*ppPositionList = clHeapCalloc(pBitmapInfo->nBytes, sizeof(ClUint8T));
if( NULL == *ppPositionList )
{
CL_DEBUG_PRINT(CL_DEBUG_ERROR, ("clHeapCalloc()"));
clOsalMutexUnlock(pBitmapInfo->bitmapLock);
return rc;
}
memcpy(*ppPositionList, pBitmapInfo->pBitmap, pBitmapInfo->nBytes);
*pListLen = pBitmapInfo->nBytes;
clOsalMutexUnlock(pBitmapInfo->bitmapLock);
CL_DEBUG_PRINT(CL_DEBUG_TRACE, ("Exit"));
return rc;
}
示例6: clMemPartRealloc
ClPtrT clMemPartRealloc(ClMemPartHandleT handle, ClPtrT memBase, ClUint32T size)
{
MEM_PART_STATS memPartStats;
ClPtrT mem = NULL;
ClMemPartT *pMemPart = NULL;
ClRcT rc = CL_OK;
if(!(pMemPart = (ClMemPartT*)handle) )
return NULL;
if(!size) size = 16;
clOsalMutexLock(&pMemPart->mutex);
if(memPartInfoGet(pMemPart->partId, &memPartStats) == ERROR)
{
clOsalMutexUnlock(&pMemPart->mutex);
CL_DEBUG_PRINT(CL_DEBUG_ERROR, ("memPartInfoGet for size [%d] failed with [%s]\n", size, strerror(errno)));
return mem;
}
if(size >= memPartStats.numBytesFree)
{
if( (rc = clMemPartExpand(pMemPart, CL_MEM_PART_EXPANSION_SIZE) ) != CL_OK)
{
/* do nothing now and fall back to realloc.*/
}
}
mem = memPartRealloc(pMemPart->partId, memBase, size);
clOsalMutexUnlock(&pMemPart->mutex);
if(!mem)
{
CL_DEBUG_PRINT(CL_DEBUG_ERROR, ("Mem part realloc failure for size [%d]\n", size));
CL_ASSERT(0);
}
return mem;
}
示例7: cpmNodeFind
/*
* Called with the cpmTableMutex lock held.
*/
ClRcT cpmNodeFind(SaUint8T *name, ClCpmLT **cpmL)
{
ClRcT rc = CL_OK;
clOsalMutexLock(gpClCpm->cpmTableMutex);
rc = cpmNodeFindLocked(name, cpmL);
clOsalMutexUnlock(gpClCpm->cpmTableMutex);
return rc;
}
示例8: clTimerStop
ClRcT
clTimerStop (ClTimerHandleT timerHandle)
{
/* make sure the timer actually exists */
ClRcT returnCode = CL_ERR_INVALID_HANDLE;
TsTimer_t* pUserTimer = NULL;
CL_FUNC_ENTER();
pUserTimer = (TsTimer_t*) timerHandle;
if (pUserTimer == NULL) {
/* debug message */
returnCode = CL_TIMER_RC(CL_ERR_INVALID_HANDLE);
clDbgCodeError(returnCode, ("Bad timer handle"));
CL_FUNC_EXIT();
return (returnCode);
}
if (pUserTimer->state == TIMER_FREE) {
returnCode = CL_TIMER_RC(CL_TIMER_ERR_INVALID_TIMER);
clDbgCodeError(returnCode, ("Attempt to stop a deleted timer."));
CL_FUNC_EXIT();
return (returnCode);
}
/* if the timer is active, remove it from the active-timers queue */
if (pUserTimer->state == TIMER_ACTIVE) {
returnCode = clOsalMutexLock (gActiveTimerQueue.timerMutex);
if (returnCode != CL_OK) {
CL_FUNC_EXIT();
return (returnCode);
}
returnCode = tsActiveTimerDequeue (pUserTimer);
if (returnCode != CL_OK) {
if(CL_OK != clOsalMutexUnlock (gActiveTimerQueue.timerMutex)) {
CL_FUNC_EXIT();
return(returnCode);
}
CL_FUNC_EXIT();
return (returnCode);
}
returnCode = clOsalMutexUnlock (gActiveTimerQueue.timerMutex);
if (returnCode != CL_OK) {
CL_FUNC_EXIT();
return (returnCode);
}
}
/* mark the timer as inactive */
pUserTimer->state = TIMER_INACTIVE;
CL_FUNC_EXIT();
return (CL_OK);
}
示例9: safTerminate
static void safTerminate(SaInvocationT invocation, const SaNameT *compName)
{
SaAisErrorT rc = SA_AIS_OK;
if(gClMsgInit)
{
ClBoolT lockStatus = CL_TRUE;
ClTimerTimeOutT timeout = {.tsSec = 0, .tsMilliSec = 0};
clOsalMutexLock(&gClMsgFinalizeLock);
while(gClMsgSvcRefCnt > 0)
{
clOsalCondWait(&gClMsgFinalizeCond, &gClMsgFinalizeLock, timeout);
}
safMsgFinalize(&lockStatus);
if(lockStatus)
{
clOsalMutexUnlock(&gClMsgFinalizeLock);
}
}
rc = saAmfComponentUnregister(amfHandle, compName, NULL);
clCpmClientFinalize(amfHandle);
//clCpmResponse(cpmHandle, invocation, CL_OK);
saAmfResponse(amfHandle, invocation, SA_AIS_OK);
return;
}
static void clMsgRegisterWithCpm(void)
{
SaAisErrorT rc = SA_AIS_OK;
SaAmfCallbacksT callbacks = {0};
SaVersionT version = {0};
version.releaseCode = 'B';
version.majorVersion = 0x01;
version.minorVersion = 0x01;
callbacks.saAmfHealthcheckCallback = NULL;
callbacks.saAmfComponentTerminateCallback = safTerminate;
callbacks.saAmfCSISetCallback = NULL;
callbacks.saAmfCSIRemoveCallback = NULL;
callbacks.saAmfProtectionGroupTrackCallback = NULL;
rc = saAmfInitialize(&amfHandle, &callbacks, &version);
if( rc != SA_AIS_OK)
{
clLogError("MSG", "INI", "saAmfInitialize failed with error code [0x%x].", rc);
return ;
}
rc = saAmfComponentNameGet(amfHandle, &appName);
rc = saAmfComponentRegister(amfHandle, &appName, NULL);
}
示例10: clLogError
static ClAmsEntityTriggerT *clAmsEntityTriggerCreate(ClAmsEntityT *pEntity,
ClMetricT *pMetric)
{
ClAmsEntityTriggerT *pEntityTrigger = NULL;
if(!pEntity || !pMetric)
goto out;
if(pMetric->id >= CL_METRIC_MAX)
{
clLogError("TRIGGER", "CREATE",
"Invalid metric [%#x] for entity [%.*s]",
pMetric->id, pEntity->name.length-1, pEntity->name.value);
goto out;
}
clOsalMutexLock(&gClAmsEntityTriggerList.list.mutex);
pEntityTrigger = clAmsEntityTriggerFind(pEntity);
if(!pEntityTrigger)
{
clOsalMutexUnlock(&gClAmsEntityTriggerList.list.mutex);
pEntityTrigger = (ClAmsEntityTriggerT*) clHeapCalloc(1, sizeof(*pEntityTrigger));
if(!pEntityTrigger)
{
clLogError("TRIGGER", "CREATE", "Memory allocation failure");
goto out;
}
memcpy(&pEntityTrigger->entity, pEntity, sizeof(pEntityTrigger->entity));
clAmsEntityTriggerLoadDefaults(pEntityTrigger, CL_METRIC_ALL);
clLogNotice("TRIGGER", "CREATE", "Entity [%.*s], Metric [%#x]",
pEntity->name.length-1, pEntity->name.value, pMetric->id);
clOsalMutexLock(&gClAmsEntityTriggerList.list.mutex);
clAmsEntityTriggerListAdd(pEntityTrigger);
}
clAmsEntityTriggerUpdate(pEntityTrigger, pMetric);
clAmsEntityTriggerCheck(pEntityTrigger, pMetric);
clOsalMutexUnlock(&gClAmsEntityTriggerList.list.mutex);
out:
return pEntityTrigger;
}
示例11: clAmsEntityTriggerRecoveryListAdd
static __inline__ ClRcT clAmsEntityTriggerRecoveryListAdd(ClAmsEntityTriggerT *pEntityTrigger)
{
clOsalMutexLock(&gClAmsEntityTriggerRecoveryCtrl.list.mutex);
clListAddTail(&pEntityTrigger->list,
&gClAmsEntityTriggerRecoveryCtrl.list.list);
++gClAmsEntityTriggerRecoveryCtrl.list.numElements;
clOsalCondSignal(&gClAmsEntityTriggerRecoveryCtrl.list.cond);
clOsalMutexUnlock(&gClAmsEntityTriggerRecoveryCtrl.list.mutex);
return CL_OK;
}
示例12: cpmInvocationGet
ClRcT cpmInvocationGet(ClInvocationT invocationId,
ClUint32T *cbType,
void **data)
{
ClRcT rc = CL_OK;
clOsalMutexLock(gpClCpm->invocationMutex);
rc = cpmInvocationGetWithLock(invocationId, cbType, data);
clOsalMutexUnlock(gpClCpm->invocationMutex);
return rc;
}
示例13: clPyGlueTerminate
void clPyGlueTerminate()
{
clRunPython("eoApp.Stop()");
clOsalCondBroadcast (&event);
clOsalMutexLock(&pyMutex);
quit=1;
PyEval_AcquireThread(thrdState);
Py_Finalize();
clOsalMutexUnlock(&pyMutex);
}
示例14: clEoNotificationCallbackInstall
ClRcT clEoNotificationCallbackInstall(ClIocPhysicalAddressT compAddr, ClPtrT pFunc, ClPtrT pArg, ClHandleT *pHandle)
{
ClRcT rc = CL_OK;
ClUint32T i = 0;
ClEoCallbackRecT **tempDb;
if(pFunc == NULL || pHandle == NULL)
{
return CL_EO_RC(CL_ERR_INVALID_PARAMETER);
}
rc = clOsalMutexLock(&gpCallbackDb.lock);
if(rc != CL_OK)
{
/* Print an error message here */
return rc;
}
re_check:
for(; i < gpCallbackDb.numRecs; i++)
{
if(gpCallbackDb.pDb[i] == NULL)
{
ClEoCallbackRecT *pRec = {0};
pRec =(ClEoCallbackRecT *)clHeapAllocate(sizeof(ClEoCallbackRecT));
pRec->node = compAddr.nodeAddress;
pRec->port = compAddr.portId;
pRec->pFunc = *((ClCpmNotificationFuncT*)&pFunc);
pRec->pArg = pArg;
*pHandle = i;
gpCallbackDb.pDb[i] = pRec;
goto out;
}
}
tempDb = clHeapRealloc(gpCallbackDb.pDb, sizeof(ClEoCallbackRecT *) * gpCallbackDb.numRecs * 2);
if(tempDb == NULL)
{
rc = CL_EO_RC(CL_ERR_NO_MEMORY);
goto out;
}
memset(tempDb + gpCallbackDb.numRecs, 0, sizeof(ClEoCallbackRecT *) * gpCallbackDb.numRecs);
gpCallbackDb.pDb = tempDb;
gpCallbackDb.numRecs *= 2;
goto re_check;
out :
clOsalMutexUnlock(&gpCallbackDb.lock);
return rc;
}
示例15: clCpmComponentListAll
ClRcT clCpmComponentListAll(ClUint32T argc, ClCharT *argv[], ClCharT **retStr)
{
ClRcT rc = CL_OK;
clOsalMutexLock(gpClCpm->compTableMutex);
rc = _clCpmComponentListAll(argc, retStr);
clOsalMutexUnlock(gpClCpm->compTableMutex);
return rc;
}