当前位置: 首页>>代码示例>>C++>>正文


C++ CL_ASSERT函数代码示例

本文整理汇总了C++中CL_ASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ CL_ASSERT函数的具体用法?C++ CL_ASSERT怎么用?C++ CL_ASSERT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了CL_ASSERT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: cl_qcpool_destroy

void cl_qcpool_destroy(IN cl_qcpool_t * const p_pool)
{
	/* CL_ASSERT that a non-NULL pointer was provided. */
	CL_ASSERT(p_pool);
	/* CL_ASSERT that we are in a valid state (not uninitialized memory). */
	CL_ASSERT(cl_is_state_valid(p_pool->state));

	if (p_pool->state == CL_INITIALIZED) {
		/*
		 * Assert if the user hasn't put everything back in the pool
		 * before destroying it
		 * if they haven't, then most likely they are still using memory
		 * that will be freed, and the destructor will not be called!
		 */
#ifdef _DEBUG_
		/* but we do not want "free" version to assert on this one */
		CL_ASSERT(cl_qcpool_count(p_pool) == p_pool->num_objects);
#endif
		/* call the user's destructor for each object in the pool */
		if (p_pool->pfn_dtor) {
			while (!cl_is_qlist_empty(&p_pool->free_list)) {
				p_pool->pfn_dtor((cl_pool_item_t *)
						 cl_qlist_remove_head(&p_pool->
								      free_list),
						 (void *)p_pool->context);
			}
		} else {
			cl_qlist_remove_all(&p_pool->free_list);
		}

		/* Free all allocated memory blocks. */
		while (!cl_is_qlist_empty(&p_pool->alloc_list))
			free(cl_qlist_remove_head(&p_pool->alloc_list));

		if (p_pool->component_sizes) {
			free(p_pool->component_sizes);
			p_pool->component_sizes = NULL;
		}
	}

	p_pool->state = CL_UNINITIALIZED;
}
开发者ID:2014-class,项目名称:freerouter,代码行数:42,代码来源:cl_pool.c

示例2: clPyGlueInit

void clPyGlueInit(char* appModule,void (*init_extensions[])(void),int argc, char**argv)
{
  char buf[1024];
  ClRcT rc;
    Py_Initialize();
    PySys_SetArgv(argc, argv);
    PyEval_InitThreads();
    
    if (init_extensions) 
      {
        int i = 0;
        for(i=0; init_extensions[i]!=NULL; i++) (*init_extensions[i])();
      }
    thrdState = PyThreadState_Get();

    rc = clOsalMutexInit(&pyMutex);
    CL_ASSERT(rc==CL_OK); 

    rc = clOsalCondInit(&event);
    CL_ASSERT(rc==CL_OK); 

    rc = clOsalMutexLock(&pyMutex);
    CL_ASSERT(rc==CL_OK); 

    PyThreadState_Swap(thrdState);

    PyRun_SimpleString("import os, os.path, sys\n");
    snprintf(buf,1024,"sys.path.append(os.path.realpath('%s'))\n",CL_APP_BINDIR);
    clprintf(CL_LOG_SEV_INFO, buf);
    PyRun_SimpleString(buf);
    //PyRun_SimpleString("sys.path.append(os.path.realpath('../../bin'))\n");
    snprintf(buf,1024,"from %s import *\n",appModule);
    clprintf(CL_LOG_SEV_INFO, buf);
    PyRun_SimpleString(buf);

    PyThreadState_Swap(NULL);
    PyEval_ReleaseLock();

    rc=clOsalMutexUnlock(&pyMutex);
    CL_ASSERT(rc==CL_OK); 

}
开发者ID:joaohf,项目名称:SAFplus-Availability-Scalability-Platform,代码行数:42,代码来源:pyglue.c

示例3: si_rcv_get_fwd_tbl

/**********************************************************************
 The plock must be held before calling this function.
**********************************************************************/
static void si_rcv_get_fwd_tbl(IN osm_sm_t * sm, IN osm_switch_t * p_sw)
{
	osm_madw_context_t context;
	osm_dr_path_t *p_dr_path;
	osm_physp_t *p_physp;
	osm_node_t *p_node;
	uint32_t block_id_ho;
	uint32_t max_block_id_ho;
	ib_api_status_t status = IB_SUCCESS;

	OSM_LOG_ENTER(sm->p_log);

	CL_ASSERT(p_sw);

	p_node = p_sw->p_node;

	CL_ASSERT(osm_node_get_type(p_node) == IB_NODE_TYPE_SWITCH);

	context.lft_context.node_guid = osm_node_get_node_guid(p_node);
	context.lft_context.set_method = FALSE;

	max_block_id_ho = osm_switch_get_max_block_id_in_use(p_sw);

	p_physp = osm_node_get_physp_ptr(p_node, 0);
	p_dr_path = osm_physp_get_dr_path_ptr(p_physp);

	for (block_id_ho = 0; block_id_ho <= max_block_id_ho; block_id_ho++) {
		OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
			"Retrieving FT block %u\n", block_id_ho);

		status = osm_req_get(sm, p_dr_path, IB_MAD_ATTR_LIN_FWD_TBL,
				     cl_hton32(block_id_ho),
				     CL_DISP_MSGID_NONE, &context);
		if (status != IB_SUCCESS)
			/* continue the loop despite the error */
			OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3603: "
				"Failure initiating PortInfo request (%s)\n",
				ib_get_err_str(status));
	}

	OSM_LOG_EXIT(sm->p_log);
}
开发者ID:ChristianKniep,项目名称:opensm-qnibng,代码行数:45,代码来源:osm_sw_info_rcv.c

示例4: osm_ucast_mgr_destroy

void osm_ucast_mgr_destroy(IN osm_ucast_mgr_t * p_mgr)
{
	CL_ASSERT(p_mgr);

	OSM_LOG_ENTER(p_mgr->p_log);

	if (p_mgr->cache_valid)
		osm_ucast_cache_invalidate(p_mgr);

	OSM_LOG_EXIT(p_mgr->p_log);
}
开发者ID:FreeBSDFoundation,项目名称:freebsd,代码行数:11,代码来源:osm_ucast_mgr.c

示例5: clGmsClusterTrackCallbackHandler

/*----------------------------------------------------------------------------
 *  Cluster Track Callback Handler
 *---------------------------------------------------------------------------*/
ClRcT clGmsClusterTrackCallbackHandler(
    CL_IN   ClGmsClusterTrackCallbackDataT* const res)
{
    ClRcT rc = CL_OK;
    struct gms_instance *gms_instance_ptr = NULL;
    ClGmsHandleT gmsHandle = CL_GMS_INVALID_HANDLE;

    CL_ASSERT(res != NULL);
    clLog(INFO,NA,NA,"received cluster track callback");

    gmsHandle = res->gmsHandle;
    rc = clHandleCheckout(gmsHandleDb, gmsHandle, (void**)&gms_instance_ptr);
    if (rc != CL_OK)
    {
        goto error_free_res;
    }

    if (gms_instance_ptr == NULL)
    {
        rc = CL_GMS_RC(CL_ERR_NULL_POINTER);
        goto error_free_res;
    }

    if (gms_instance_ptr->callbacks.clGmsClusterTrackCallback == NULL)
    {
        rc = CL_GMS_RC(CL_ERR_NO_CALLBACK);
        goto error_checkin_free_res;
    }

    /*
     * Calling the user's callback function with the data.  The user cannot
     * free the data we provide.  If it needs to reatin it, it has to copy
     * it out from what we provide here.
     */
            (*gms_instance_ptr->callbacks.clGmsClusterTrackCallback)
            (gmsHandle, &res->buffer, res->numberOfMembers, res->rc);
  

error_checkin_free_res:
    if (clHandleCheckin(gmsHandleDb, gmsHandle) != CL_OK)
    {
        clLogError(CLM,NA,
                   "\nclHandleCheckin failed");
    }

error_free_res:
    /* Need to free data (res) if are not able to call the actual callback */
    if (res->buffer.notification != NULL)
    {
        clHeapFree((void*)res->buffer.notification);
    }
    clHeapFree((void*)res);
    return rc;
}
开发者ID:mrv-communications-pilot,项目名称:SAFplus-Availability-Scalability-Platform,代码行数:57,代码来源:clGmsApi.c

示例6: clTransportNotifyRegister

ClRcT clTransportNotifyRegister(ClTransportNotifyCallbackT callback, ClPtrT arg)
{
    ClTransportNotifyRegistrantT *registrant = NULL;
    if(!callback) return CL_ERR_INVALID_PARAMETER;
    registrant = clHeapCalloc(1, sizeof(*registrant));
    CL_ASSERT(registrant != NULL);
    registrant->callback = callback;
    registrant->arg = arg;
    clListAddTail(&registrant->list, &gClXportNotifyRegistrants);
    return CL_OK;
}
开发者ID:NguyenHoangOC,项目名称:SAFplus-Availability-Scalability-Platform,代码行数:11,代码来源:clTransportNotify.c

示例7: clMemPartInitialize

ClRcT clMemPartInitialize(ClMemPartHandleT *pMemPartHandle, ClUint32T memPartSize)
{
    ClCharT *pool = NULL;
    ClInt32T i;
    ClRcT rc = CL_OK;
    ClMemPartT *pMemPart = NULL;

    if(!pMemPartHandle)
        return CL_ERR_INVALID_PARAMETER;

    if(!memPartSize)
        memPartSize = CL_MEM_PART_SIZE;

    pMemPart = calloc(1, sizeof(*pMemPart));
    CL_ASSERT(pMemPart !=  NULL);

    rc= clOsalMutexInit(&pMemPart->mutex);
    CL_ASSERT(rc == CL_OK);

    for(i = 0; i < CL_MEM_PART_EXPANSION_SLOTS; ++i)
        pMemPart->partitions[i] = NULL;

    pMemPart->index = 0;
    pool = malloc(memPartSize);
    if(!pool)
    {
        CL_DEBUG_PRINT(CL_DEBUG_ERROR, ("CALLOC failed for size [%d] while trying to create MEM partition\n", 
                                        memPartSize));
        return CL_ERR_NO_MEMORY;
    }
    pMemPart->partId = memPartCreate(pool, memPartSize);
    if(!pMemPart->partId)
    {
        free(pool);
        CL_DEBUG_PRINT(CL_DEBUG_ERROR, ("memPartCreate for size [%d] failed\n", memPartSize));
        return CL_ERR_NO_MEMORY;
    }
    pMemPart->partitions[pMemPart->index++] = pool;
    *pMemPartHandle = (ClMemPartHandleT)pMemPart;
    return CL_OK;
}
开发者ID:NguyenHoangOC,项目名称:SAFplus-Availability-Scalability-Platform,代码行数:41,代码来源:clMemPart.c

示例8: cycle_exists

static int cycle_exists(cdg_vertex_t * start, cdg_vertex_t * current,
			cdg_vertex_t * prev, int visit_num)
{
	int i, new_visit_num;
	int cycle_found = 0;

	if (current != NULL && current->visiting_number > 0) {
		if (visit_num > current->visiting_number && current->seen == 0) {
			cycle_found = 1;
		}
	} else {
		if (current == NULL) {
			current = start;
			CL_ASSERT(prev == NULL);
		}

		current->visiting_number = visit_num;

		if (prev != NULL) {
			prev->next = current;
			CL_ASSERT(prev->to == current->from);
			CL_ASSERT(prev->visiting_number > 0);
		}

		new_visit_num = visit_num + 1;

		for (i = 0; i < current->num_deps; i++) {
			cycle_found =
			    cycle_exists(start, current->deps[i].v, current,
					 new_visit_num);
			if (cycle_found == 1)
				i = current->num_deps;
		}

		current->seen = 1;
		if (prev != NULL)
			prev->next = NULL;
	}

	return cycle_found;
}
开发者ID:FreeBSDFoundation,项目名称:freebsd,代码行数:41,代码来源:osm_ucast_lash.c

示例9: clEsmInstanceRestart

/**
 *  ReStarts the extended state machine instance.
 *
 *  Please refer to the FSM Restart API.
 *
 *  @param smThis State Machine Object
 *
 *  @returns 
 *    CL_OK on CL_OK (successful start) <br/>
 *    CL_SM_RC(CL_ERR_NULL_POINTER) on invalid/null instance handle <br/>
 *
 *  @see #clSmInstanceStart
 */
ClRcT
clEsmInstanceRestart(ClExSmInstancePtrT smThis
                  )
{
    CL_ASSERT(smThis);
    if(smThis)
      {
        return clSmInstanceRestart(smThis->fsm);
      }
    
    return CL_SM_RC(CL_ERR_NULL_POINTER);
}
开发者ID:joaohf,项目名称:SAFplus-Availability-Scalability-Platform,代码行数:25,代码来源:clSmExtended.c

示例10: clEoQueueStatsStop

void clEoQueueStatsStop(ClUint32T queueSize, ClEoJobT *pJob, ClEoQueueStatsT *pStats)
{
    ClUint8T proto = pJob->msgParam.protoType;
    ClUint8T priority = CL_EO_RECV_QUEUE_PRI(pJob->msgParam);
    ClUint64T timeDiff=0;
    gettimeofday(&pStats->end, NULL);
    CL_ASSERT(pStats->priority == priority);
    CL_ASSERT(pStats->proto == proto);
    pStats->end.tv_sec -= pStats->start.tv_sec;
    pStats->end.tv_usec -= pStats->start.tv_usec;
    if(pStats->end.tv_sec < 0)
        pStats->end.tv_sec = 0, pStats->end.tv_usec = 0;
    else if(pStats->end.tv_usec < 0)
    {
        --pStats->end.tv_sec;
        pStats->end.tv_usec += 1000000L;
    }
    timeDiff = (ClUint64T)pStats->end.tv_sec*1000000L + pStats->end.tv_usec;
    pStats->totalTime = timeDiff;
    clEoQueueStatsUpdate(pStats);
}
开发者ID:NguyenHoangOC,项目名称:SAFplus-Availability-Scalability-Platform,代码行数:21,代码来源:clEoQueue.c

示例11: __osm_set_wrid_by_p_madw

/*
  Since a race can accure on requests. Meaning - a response is received before
  the send_callback is called - we will save both the madw_p and the fact
  whether or not it is a response. A race can occure only on requests that did
  not fail, and then the madw_p will be put back in the pool before the
  callback.
*/
uint64_t __osm_set_wrid_by_p_madw(IN osm_madw_t * p_madw)
{
	uint64_t wrid = 0;

	CL_ASSERT(p_madw->p_mad);

	memcpy(&wrid, &p_madw, sizeof(osm_madw_t *));
	wrid = (wrid << 1) |
	    ib_mad_is_response(p_madw->p_mad) |
	    (p_madw->p_mad->method == IB_MAD_METHOD_TRAP_REPRESS);
	return wrid;
}
开发者ID:2014-class,项目名称:freerouter,代码行数:19,代码来源:osm_vendor_ts.c

示例12: osm_nd_rcv_process

void osm_nd_rcv_process(IN void *context, IN void *data)
{
	osm_sm_t *sm = context;
	osm_madw_t *p_madw = data;
	ib_node_desc_t *p_nd;
	ib_smp_t *p_smp;
	osm_node_t *p_node;
	ib_net64_t node_guid;

	CL_ASSERT(sm);

	OSM_LOG_ENTER(sm->p_log);

	CL_ASSERT(p_madw);

	p_smp = osm_madw_get_smp_ptr(p_madw);
	if (ib_smp_get_status(p_smp)) {
		OSM_LOG(sm->p_log, OSM_LOG_DEBUG,
			"MAD status 0x%x received\n",
			cl_ntoh16(ib_smp_get_status(p_smp)));
		goto Exit;
	}

	p_nd = ib_smp_get_payload_ptr(p_smp);

	/* Acquire the node object and add the node description. */
	node_guid = osm_madw_get_nd_context_ptr(p_madw)->node_guid;
	CL_PLOCK_EXCL_ACQUIRE(sm->p_lock);
	p_node = osm_get_node_by_guid(sm->p_subn, node_guid);
	if (!p_node)
		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0B01: "
			"NodeDescription received for nonexistent node "
			"0x%" PRIx64 "\n", cl_ntoh64(node_guid));
	else
		nd_rcv_process_nd(sm, p_node, p_nd);

	CL_PLOCK_RELEASE(sm->p_lock);
Exit:
	OSM_LOG_EXIT(sm->p_log);
}
开发者ID:FreeBSDFoundation,项目名称:freebsd,代码行数:40,代码来源:osm_node_desc_rcv.c

示例13: CL_ASSERT

osm_madw_t *osm_mad_pool_get(IN osm_mad_pool_t * const p_pool,
                             IN osm_bind_handle_t h_bind,
                             IN const uint32_t total_size,
                             IN const osm_mad_addr_t * const p_mad_addr)
{
    osm_madw_t *p_madw;
    ib_mad_t *p_mad;

    CL_ASSERT(h_bind != OSM_BIND_INVALID_HANDLE);
    CL_ASSERT(total_size);

    /*
       First, acquire a mad wrapper from the mad wrapper pool.
     */
    p_madw = malloc(sizeof(*p_madw));
    if (p_madw == NULL)
        goto Exit;

    osm_madw_init(p_madw, h_bind, total_size, p_mad_addr);

    /*
       Next, acquire a wire mad of the specified size.
     */
    p_mad = osm_vendor_get(h_bind, total_size, &p_madw->vend_wrap);
    if (p_mad == NULL) {
        /* Don't leak wrappers! */
        free(p_madw);
        p_madw = NULL;
        goto Exit;
    }

    cl_atomic_inc(&p_pool->mads_out);
    /*
       Finally, attach the wire MAD to this wrapper.
     */
    osm_madw_set_mad(p_madw, p_mad);

Exit:
    return p_madw;
}
开发者ID:cyrilmagsuci,项目名称:freebsd,代码行数:40,代码来源:osm_mad_pool.c

示例14: __osmv_txnmgr_lookup

ib_api_status_t
__osmv_txnmgr_lookup(IN osmv_txn_mgr_t * p_tx_mgr,
		     IN uint64_t key, OUT osmv_txn_ctx_t ** pp_txn)
{
	ib_api_status_t status = IB_SUCCESS;
	cl_map_item_t *p_item;
	cl_map_obj_t *p_obj;

	uint64_t tmp_key;

	OSM_LOG_ENTER(p_tx_mgr->p_log);

	CL_ASSERT(p_tx_mgr);
	CL_ASSERT(pp_txn);

	osm_log(p_tx_mgr->p_log, OSM_LOG_DEBUG,
		"__osmv_txnmgr_lookup: "
		"Looking for key: 0x%llX in map ptr:%p\n", key,
		p_tx_mgr->p_txn_map);

	p_item = cl_qmap_head(p_tx_mgr->p_txn_map);
	while (p_item != cl_qmap_end(p_tx_mgr->p_txn_map)) {
		tmp_key = cl_qmap_key(p_item);
		osm_log(p_tx_mgr->p_log, OSM_LOG_DEBUG,
			"__osmv_txnmgr_lookup: "
			"Found key 0x%llX \n", tmp_key);
		p_item = cl_qmap_next(p_item);
	}

	p_item = cl_qmap_get(p_tx_mgr->p_txn_map, key);
	if (cl_qmap_end(p_tx_mgr->p_txn_map) == p_item) {
		status = IB_NOT_FOUND;
	} else {
		p_obj = PARENT_STRUCT(p_item, cl_map_obj_t, item);
		*pp_txn = cl_qmap_obj(p_obj);
	}

	OSM_LOG_EXIT(p_tx_mgr->p_log);
	return status;
}
开发者ID:2014-class,项目名称:freerouter,代码行数:40,代码来源:osm_vendor_mlx_txn.c

示例15: clDispatchSelectionObjectGet

/* 
 * clDispatchSelectionObject returns the selection object [readFd] associated
 * with this particular initialization of the dispatch library 
 */
ClRcT   clDispatchSelectionObjectGet(
        CL_IN   ClHandleT           dispatchHandle,
        CL_OUT  ClSelectionObjectT* pSelectionObject)
{
    ClRcT   rc = CL_OK;
    ClDispatchDbEntryT* thisDbEntry = NULL;

    if (pSelectionObject == NULL)
    {
        return CL_ERR_NULL_POINTER;
    }

    CHECK_LIB_INIT;

    rc = clHandleCheckout(databaseHandle, dispatchHandle, (void *)&thisDbEntry);
    if (rc != CL_OK)
    {
        return CL_ERR_INVALID_HANDLE;
    }
    CL_ASSERT(thisDbEntry != NULL);

    rc = clOsalMutexLock(thisDbEntry->dispatchMutex);
    if (rc != CL_OK)
    {
        goto error_return;
    }

    if (thisDbEntry->shouldDelete == CL_TRUE)
    {
        rc = CL_ERR_INVALID_HANDLE;
        goto error_unlock_return;
    }
    
    *pSelectionObject = (ClSelectionObjectT)thisDbEntry->readFd;

error_unlock_return:
    rc = clOsalMutexUnlock(thisDbEntry->dispatchMutex);
    if (rc != CL_OK)
    {
        CL_DEBUG_PRINT(CL_DEBUG_ERROR,
                ("Mutex Unlock failed with rc = 0x%x\n",rc));
    }

error_return:
    if ((clHandleCheckin(databaseHandle, dispatchHandle)) != CL_OK)
    {
        CL_DEBUG_PRINT(CL_DEBUG_ERROR,
                ("clHandleCheckin failed"));
    }

    return rc;
}
开发者ID:NguyenHoangOC,项目名称:SAFplus-Availability-Scalability-Platform,代码行数:56,代码来源:clDispatchApi.c


注:本文中的CL_ASSERT函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。