• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ Memory_free函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: ti_sdo_ipc_Notify_Instance_finalize

/*
 *  ======== ti_sdo_ipc_Notify_Instance_finalize ========
 */
Void ti_sdo_ipc_Notify_Instance_finalize(ti_sdo_ipc_Notify_Object *obj,
        Int status)
{
    UInt    i;
    UInt16  clusterId = ti_sdo_utils_MultiProc_getClusterId(obj->remoteProcId);

    switch (status) {
    case 0:
        /* Unregister the notify instance from the Notify module */
        Notify_module->notifyHandles[clusterId][obj->lineId] = NULL;

        /* Destruct the event lists */
        for (i = 0; i < ti_sdo_ipc_Notify_numEvents; i++) {
            List_destruct(List_struct(List_Object_get(obj->eventList, i)));
        }

        /* Free memory used for the List.Objects */
        Memory_free(ti_sdo_ipc_Notify_Object_heap(), obj->eventList,
                    sizeof(List_Struct) * ti_sdo_ipc_Notify_numEvents);

    /* OK to fall through */

    case 1:
        /* Free memory used for callbacks array */
        Memory_free(ti_sdo_ipc_Notify_Object_heap(), obj->callbacks,
                    sizeof(ti_sdo_ipc_Notify_EventCallback) *
                    ti_sdo_ipc_Notify_numEvents);
    }
}
开发者ID:zaporozhets,项目名称:ti_ezsdk_tools,代码行数:32,代码来源:Notify.c


示例2: Darray_destroy

NORET Darray_destroy(Darray dyn_ary)
    {
    Darray_rep *temp = dlower(dyn_ary);
    
    Memory_free((VOIDP)temp->storage);
    Memory_free((VOIDP)temp);
    }
开发者ID:azizyemloul,项目名称:taggerXML,代码行数:7,代码来源:darray.cpp


示例3: appTaskFxn

Void appTaskFxn(UArg arg0, UArg arg1)
{
	char* args[8];
	//arg[0] is 2 chars for dev type
	args[0] = Memory_alloc(NULL, 2 * sizeof(char), 0, NULL);
	//arg[1] is 3 chars for channel num
	args[1] = Memory_alloc(NULL, 3 * sizeof(char), 0, NULL);

	//init the RPC queue
	rpcInitMq();

	//init the application thread to register the callbacks
	appInit();

	consolePrint(
	        "Enter device type c: Coordinator, r: Router, e: End Device:\n");
	consoleGetLine(args[0], 8);

	consolePrint("Enter channel 11-26:\n");
	consoleGetLine(args[1], 8);

	while (1)
	{
		appProcess(args);
		Task_sleep(10);
	}

	Memory_free(NULL, args[0], 2 * sizeof(char));
	Memory_free(NULL, args[1], 3 * sizeof(char));
}
开发者ID:GisKook,项目名称:smarthomebox,代码行数:30,代码来源:main.c


示例4: LoggerBuf_Instance_finalize

/*
 *  ======== LoggerBuf_Instance_finalize ========
 */
Void LoggerBuf_Instance_finalize(LoggerBuf_Object *obj, Int status)
{
    if (obj->entryArr != NULL) {
        Memory_free(obj->bufHeap, obj->entryArr,
                    obj->numEntries * sizeof (LoggerBuf_Entry));
    }
}
开发者ID:zaporozhets,项目名称:ti_ezsdk_tools,代码行数:10,代码来源:LoggerBuf.c


示例5: do_memoryAlloc

static int do_memoryAlloc(CodecEngine* _ce, size_t _srcBufferSize, size_t _dstBufferSize)
{
  memset(&_ce->m_allocParams, 0, sizeof(_ce->m_allocParams));
  _ce->m_allocParams.type = Memory_CONTIGPOOL;
  _ce->m_allocParams.flags = Memory_CACHED;
  _ce->m_allocParams.align = BUFALIGN;
  _ce->m_allocParams.seg = 0;

  _ce->m_srcBufferSize = ALIGN_UP(_srcBufferSize, BUFALIGN);
  if ((_ce->m_srcBuffer = Memory_alloc(_ce->m_srcBufferSize, &_ce->m_allocParams)) == NULL)
  {
    fprintf(stderr, "Memory_alloc(src, %zu) failed\n", _ce->m_srcBufferSize);
    _ce->m_srcBufferSize = 0;
    return ENOMEM;
  }

  _ce->m_dstBufferSize = ALIGN_UP(_dstBufferSize, BUFALIGN);
  if ((_ce->m_dstBuffer = Memory_alloc(_ce->m_dstBufferSize, &_ce->m_allocParams)) == NULL)
  {
    fprintf(stderr, "Memory_alloc(dst, %zu) failed\n", _ce->m_dstBufferSize);
    _ce->m_dstBufferSize = 0;
    Memory_free(_ce->m_srcBuffer, _ce->m_srcBufferSize, &_ce->m_allocParams);
    _ce->m_srcBuffer = NULL;
    _ce->m_srcBufferSize = 0;
    return ENOMEM;
  }

  return 0;
}
开发者ID:Rauf-Kurbanov,项目名称:trik-v4l2-dsp-fb,代码行数:29,代码来源:ce.c


示例6: MessageQ_free

/*
 *  ======== MessageQ_free ========
 */
Int MessageQ_free(MessageQ_Msg msg)
{
    IHeap_Handle heap;

    /* make sure msg is not NULL */
    Assert_isTrue((msg != NULL), ti_sdo_ipc_MessageQ_A_invalidMsg);
    
    /* Cannot free a message that was initialized via MessageQ_staticMsgInit */
    Assert_isTrue((msg->heapId != ti_sdo_ipc_MessageQ_STATICMSG), 
                  ti_sdo_ipc_MessageQ_A_cannotFreeStaticMsg);
    
    Assert_isTrue((msg->heapId < MessageQ_module->numHeaps),
                  ti_sdo_ipc_MessageQ_A_heapIdInvalid);

    Assert_isTrue((MessageQ_module->heaps[msg->heapId] != NULL),
                  ti_sdo_ipc_MessageQ_A_heapIdInvalid);

    if ((ti_sdo_ipc_MessageQ_traceFlag == TRUE) ||
        (msg->flags & ti_sdo_ipc_MessageQ_TRACEMASK) != 0) {                    
        Log_write3(ti_sdo_ipc_MessageQ_LM_free, (UArg)(msg), 
            (UArg)(msg->seqNum), (UArg)(msg->srcProc));
    }
    
    heap = MessageQ_module->heaps[msg->heapId];
    
    if (heap != NULL) {
        Memory_free(heap, msg, msg->msgSize);
    }
    else {
        return (MessageQ_E_FAIL);
    }

    return (MessageQ_S_SUCCESS);
}
开发者ID:andreimironenko,项目名称:ipc,代码行数:37,代码来源:MessageQ.c


示例7: Power_unregisterConstraint

/*
 *  ======== Power_unregisterConstraint ========
 *  Unregister for a power notification.
 *
 */
Power_Status Power_unregisterConstraint(Power_ConstraintHandle handle)
{
    Power_Status status = Power_SOK;
    Power_Constraint type;
    UInt key;

    /* check for NULL constraintHandle */
    if (handle == NULL) {
        status = Power_EINVALIDHANDLE;
    }

    /* else, remove and delete constraint object, update aggregate constraint */
    else {
        key = Hwi_disable();
        Queue_remove((Queue_Elem *)handle);
        Hwi_restore(key);

        /* recompute aggregate constraint w/absence of removed constraint */
        type = ((Power_ConstraintObj *) handle)->type;
        Power_rebuildConstraint(type);

        /* free the constraint object */
        Memory_free(Power_Object_heap(), handle, sizeof(Power_ConstraintObj));
    }

    return (status);
}
开发者ID:alexeicolin,项目名称:sysbios,代码行数:32,代码来源:Power.c


示例8: Algorithm_delete

/*
 *  ======== Algorithm_delete ========
 */
Void Algorithm_delete(Algorithm_Handle alg)
{
    Algorithm_Obj *pObject = (Algorithm_Obj *)alg;
    IRES_Status status;

    Log_print1(Diags_ENTRY, "[+E] Algorithm_delete> Enter(alg=0x%x)",
            (IArg)alg);

    if (pObject != NULL) {
        if (pObject->iresFxns) {
            /* Call RMAN fuction to free resources */
            status = RMAN_freeResources(pObject->alg, pObject->iresFxns,
                    pObject->groupId);
            if (status != IRES_OK) {
                Log_print1(Diags_USER7, "[+7] Algorithm_delete> Freeing "
                        "of alg resources through RMAN FAILED (0x%x)",
                        (IArg)status);
            }
        }

        if (pObject->alg) {
            DSKT2_freeAlg(pObject->groupId, pObject->alg);
        }

        Memory_free(pObject, sizeof (*pObject), NULL);
    }

    Log_print0(Diags_EXIT, "[+X] Algorithm_delete> Exit");
}
开发者ID:mobiaqua,项目名称:ti-ce,代码行数:32,代码来源:Algorithm_BIOS.c


示例9: Algorithm_delete

/*
 *  ======== Algorithm_delete ========
 */
Void Algorithm_delete(Algorithm_Handle alg)
{
    Algorithm_Obj *pObject = (Algorithm_Obj *)alg;
    IRES_Status status;

    Log_print1(Diags_ENTRY, "[+E] Algorithm_delete> Enter(alg=0x%x)",
            (IArg)alg);

    if (pObject != NULL) {
        if (pObject->iresFxns) {
            /* Call RMAN fuction to free resources */
            status = RMAN_freeResources(pObject->alg, pObject->iresFxns,
                    pObject->groupId);
            if (status != IRES_OK) {
                Log_print1(Diags_USER7, "[+7] Algorithm_delete> Freeing "
                        "of alg resources through RMAN FAILED (0x%x)",
                        (IArg)status);
            }
        }

        if (pObject->idma3Fxns) {
            Log_print0(Diags_USER4, "[+4] Algorithm_delete> releasing "
                    "DMA resources");
            DMAN3_releaseDmaChannels(&(pObject->alg), &(pObject->idma3Fxns),1);
        }

        if (pObject->alg) {
            ALG_delete(pObject->groupId, pObject->alg, pObject->useCachedMem);
        }

        Memory_free(pObject, sizeof (*pObject), NULL);
    }

    Log_print0(Diags_EXIT, "[+X] Algorithm_delete> Exit");
}
开发者ID:andreimironenko,项目名称:codec-engine,代码行数:38,代码来源:Algorithm_noOS.c


示例10: _XdmServer_freeXdaisAlgMemory

void _XdmServer_freeXdaisAlgMemory(IALG_MemRec memTab[], Int numRecs)
{
    Int idx;
    uint8_t                 *handle;
    uint8_t                 *RPE_dspIramHeapHandle = globaL2heap;
    
    for (idx = 0; idx < numRecs; idx++) 
    {
        if (memTab[idx].base != NULL) 
        {
            if ( memTab[idx].space > IALG_SARAM2 ) 
            { 
                handle = RPE_dspAlgHeapHandle;
            }
            else
            {
                handle = RPE_dspIramHeapHandle;
            }

            /* Freeing a buffer of size 0 is not possible, so we allocate     */
            /* 8 bytes during creation. This is taken care during deletion    */
            if (memTab[idx].size == 0)
            {
                memTab[idx].size = 8;
            }
            
            Memory_free ((IHeap_Handle) handle, memTab[idx].base, memTab[idx].size);
        }
    }
    return;
}
开发者ID:andreimironenko,项目名称:rpe,代码行数:31,代码来源:xdm_server.c


示例11: MEM_increaseTableSize

/*
 *  ======== MEM_increaseTableSize ========
 */
Int MEM_increaseTableSize(Uns numEntries)
{
    IArg                key;
    IHeap_Handle       *tmpTable;
    Error_Block         eb;
    
    Error_init(&eb);

    /* Use HeapMem's gate for thread-safety */
    key = HeapMem_enter();

    tmpTable = Memory_calloc(MEM_table[0],
        (MEM_tabSize + numEntries) * sizeof(IHeap_Handle), 0, NULL);
    
    if (tmpTable == NULL) {
        HeapMem_leave(key);
        return (SYS_EALLOC);
    }

    memcpy(tmpTable, MEM_table, MEM_tabSize * sizeof(IHeap_Handle));

    if ((MEM_tabSize != 0) && (staticTable != TRUE)) {
        Memory_free(MEM_table[0], MEM_table, MEM_tabSize * sizeof(IHeap_Handle));
    }

    staticTable = FALSE;
    MEM_table = tmpTable;
    MEM_tabSize += numEntries;

    HeapMem_leave(key);

    return (SYS_OK);
}
开发者ID:CheredHerry,项目名称:ti-bios,代码行数:36,代码来源:mem.c


示例12: Buffer_copy

/******************************************************************************
 * Buffer_copy
 ******************************************************************************/
Int Buffer_copy(Buffer_Handle hSrcBuf, Buffer_Handle hDstBuf)
{
    assert(hSrcBuf);
    assert(hDstBuf);
    assert(hSrcBuf->type == Buffer_Type_BASIC ||
           hSrcBuf->type == Buffer_Type_GRAPHICS);

    if(hSrcBuf->type != hDstBuf->type) {
        Dmai_err1("Cannot copy to Buffer type (%d)\n", hDstBuf->type);
        return Dmai_EFAIL;
    }

    if (!hDstBuf->reference && hDstBuf->userPtr) {
        Dmai_dbg3("Free Buffer of size %u at 0x%x (0x%x phys)\n",
                  (Uns) hDstBuf->origState.numBytes,
                  (Uns) hDstBuf->userPtr,
                  (Uns) hDstBuf->physPtr);

        if (!Memory_free(hDstBuf->userPtr, hDstBuf->origState.numBytes,
                         &hDstBuf->memParams)) {
            return Dmai_EFAIL;
        }
    }

    if(hSrcBuf->type == Buffer_Type_GRAPHICS) {
        *(_BufferGfx_Object *) hDstBuf = *(_BufferGfx_Object *) hSrcBuf;
    } else {
        *(_Buffer_Object *) hDstBuf = *(_Buffer_Object *) hSrcBuf;
    }

    hDstBuf->reference = TRUE;

    return Dmai_EOK;
}
开发者ID:Soorma07,项目名称:dvsdk-dmai,代码行数:37,代码来源:Buffer.c


示例13: NODE_delete

/*
 *  ======== NODE_delete ========
 */
Int NODE_delete(NODE_Handle node)
{
    Void   *handle;

    /* Should be a DBC_requires */
    Assert_isTrue(node != NULL, (Assert_Id)NULL);
    Assert_isTrue(node->skelFxns != NULL, (Assert_Id)NULL);
    Assert_isTrue(node->skelFxns->apiDestroy != NULL, (Assert_Id)NULL);

    /* delete thread *before* destroying node to ensure thread has no access
     * to node as we are freeing it
     */
    if (node->self) {
        Log_print1(Diags_ENTRY, "[+E] NODE_delete(0x%x)", (IArg)node);

        Thread_delete(&(node->self));
    }

    handle = NODE_getEnv(node);

    if (handle) {
        node->skelFxns->apiDestroy(handle);
    }

    if (node->recv != Comm_INVALIDHANDLE) {
        Comm_delete(node->recv);
    }

    Memory_free(NULL, node, sizeof(NODE_Obj));

    return (NODE_EOK);
}
开发者ID:andreimironenko,项目名称:codec-engine,代码行数:35,代码来源:node_dele.c


示例14: SystemCfg_deleteResources

Int SystemCfg_deleteResources(SystemCfg_Object *obj)
{
    IHeap_Handle        heapH;
    Int                 status = 0;


    Log_print1(Diags_ENTRY | Diags_INFO, "--> "FXNN": (obj=0x%x)",(IArg)obj);

    /* delete opencl buffer heap */
//  HeapBufMP_delete(&obj->openclHeapH);

    /* unregister rcm message heap with MessageQ */
    MessageQ_unregisterHeap(SystemCfg_RcmMsgHeapId_CompDev);

    /* delete rcm message heap instance */
    HeapBuf_delete(&obj->rcmHeapH);

    /* free the rcm message heap storage */
    heapH = (IHeap_Handle)SharedRegion_getHeap(0);
    Memory_free(heapH, obj->rcmHeapBufBase, obj->rcmHeapBufSize);
    obj->rcmHeapBufBase = NULL;
    obj->rcmHeapBufSize = 0;

    Log_print1(Diags_EXIT, "<-- "FXNN": %d", (IArg)status);
    return(status);
}
开发者ID:andreimironenko,项目名称:framework_components,代码行数:26,代码来源:SystemCfg_host_bios.c


示例15: OMAPL1XX_halExit

/*!
 *  @brief      Function to finalize the HAL object
 *
 *  @param      halObj      Pointer to the HAL object
 *
 *  @sa         OMAPL1XX_halInit
 *              OMAPL1XX_phyShmemExit
 */
Int
OMAPL1XX_halExit (Ptr halObj)
{
    Int                  status    = PROCESSOR_SUCCESS;
    OMAPL1XX_HalObject * halObject = NULL;

    GT_1trace (curTrace, GT_ENTER, "OMAPL1XX_halExit", halObj);

    GT_assert (curTrace, (halObj != NULL));

    halObject = (OMAPL1XX_HalObject *) halObj ;
    status = OMAPL1XX_phyShmemExit (halObj);
#if !defined(SYSLINK_BUILD_OPTIMIZE)
    if (status < 0) {
        GT_setFailureReason (curTrace,
                             GT_4CLASS,
                             "OMAPL1XX_halExit",
                             status,
                             "OMAPL1XX_phyShmemExit failed!");
    }
#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */

    if (halObj != NULL) {
        /* Free the memory for the HAL object. */
        Memory_free (NULL, halObj, sizeof (OMAPL1XX_HalObject));
    }

    GT_1trace (curTrace, GT_LEAVE, "OMAPL1XX_halExit", status);

    /*! @retval PROCESSOR_SUCCESS Operation successful */
    return status;
}
开发者ID:andreimironenko,项目名称:syslink,代码行数:40,代码来源:omapl1xx_hal.c


示例16: Utils_memFree

Int32 Utils_memFree(Ptr addr, UInt32 size)
{
    UInt32 heapId = UTILS_MEM_VID_FRAME_BUF_HEAP;
    SharedRegion_Entry srEntry;

   SharedRegion_getEntry(SYSTEM_IPC_SR_VIDEO_FRAME, &srEntry);

    /* if address falls in tiler buffer then free from that heap */
    if((UInt32)addr >= (UInt32)srEntry.base && (UInt32)addr < ((UInt32)srEntry.base + srEntry.len) )
    {
        #ifdef UTILS_MEM_DEBUG
        Vps_printf(" UTILS: MEM: FRAME FREE, addr = 0x%08x, size = %d bytes, heap = %d\n", addr, size, heapId);
        #endif

        /* free previously allocated memory */
        Memory_free(gUtils_heapMemHandle[heapId], addr, size);
    }
    else
    {
        Int32 status;

        status = SystemTiler_freeRaw(addr,size);
        UTILS_assert(status == 0);
    }

    return 0;
}
开发者ID:sdut10523,项目名称:dvr_rdk,代码行数:27,代码来源:utils_mem.c


示例17: _SysLinkMemUtils_removeMapElement

/*!
 *  @brief      Remove and delete entry from the Translation Table
 *
 *  @param      da      Device address
 *
 *  @sa         _SysLinkMemUtils_insertMapElement
 */
static Ptr
_SysLinkMemUtils_removeMapElement (Ptr da)
{
    AddrNode  * node;
    Ptr         addr = NULL;

    GT_1trace (curTrace, GT_ENTER, "_SysLinkMemUtils_removeMapElement", da);

    OsalSemaphore_pend (SysLinkMemUtils_module->semList,
                        OSALSEMAPHORE_WAIT_FOREVER);
    node = _SysLinkMemUtils_findNode (da);
    if (!node || node->da != da) {
#if !defined(SYSLINK_BUILD_OPTIMIZE)
        GT_setFailureReason (curTrace,
                             GT_4CLASS,
                             (Char *)__func__,
                             PROCMGR_E_FAIL,
                             "Entry not found!");
#endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
    }
    else {
        addr = node->ua;
        List_remove (SysLinkMemUtils_module->addrTable, &node->elem);
        Memory_free (NULL, node, sizeof (AddrNode));
    }
    OsalSemaphore_post (SysLinkMemUtils_module->semList);

    GT_1trace (curTrace, GT_LEAVE, "_SysLinkMemUtils_removeMapElement", addr);

    return addr;
}
开发者ID:ZIViTi,项目名称:android_hardware_ti_omap4,代码行数:38,代码来源:SysLinkMemUtils.c


示例18: IpcResource_disconnect

Int IpcResource_disconnect(IpcResource_Handle handle)
{
    Int status;
    IpcResource_Req req;

    if (!handle) {
        System_printf("IpcResource_disconnect: handle is NULL\n");
    }

    req.resType = 0;
    req.reqType = IpcResource_REQ_TYPE_DISCONN;

    status = MessageQCopy_send(MultiProc_getId("HOST"), IpcResource_server,
                        handle->endPoint, &req, sizeof(req));
    if (status) {
        System_printf("IpcResource_disconnect: MessageQCopy_send "
                      "failed status %d\n", status);
        return status;
    }

    status = MessageQCopy_delete(&handle->msgq);
    if (status) {
        System_printf("IpcResource_disconnect: MessageQCopy_delete "
                      "failed status %d\n", status);
        return status;
    }

    Memory_free(NULL, handle, sizeof(*handle));

    return 0;
}
开发者ID:GAnthony,项目名称:sysbios-rpmsg,代码行数:31,代码来源:IpcResource.c


示例19: HeapMultiBuf_Instance_finalize

/*
 *  ======== HeapMultiBuf_Instance_finalize ========
 *  Deletes the managed HeapBuf instances and frees the memory for the 
 *  sorted buffer arrays.
 */
Void HeapMultiBuf_Instance_finalize(HeapMultiBuf_Object *obj, int status)
{
    Int i;
    
    /* If a create failed, handle the finalize based on the status. */
    switch (status) {
        /* Alloc of bufsByAddr failed. */
        case 1:
            return;
        /* Alloc of bufsBySize failed. */
        case 2:
            /* bufsByAddr succeeded, so free bufsByAddr. */
            Memory_free(NULL, obj->bufsByAddr, obj->numBufs * sizeof(HeapMultiBuf_AddrPair));
            return;
        case 3:
            /* Delete any heapBufs that were successfully created. */
            for (i = 0; i < obj->numBufs; i++) {
                /* 
                 * bufsBySize was calloc'd, so we can check for NULL to find
                 * the end of the created HeapBufs.
                 */
                if (&(obj->bufsBySize[i]) == NULL) {
                    break;
                }
                
                HeapBuf_delete(&(obj->bufsBySize[i]));
            }
            /* Free both the bufsByAddr and bufsBySize arrays. */
            Memory_free(NULL, obj->bufsByAddr, obj->numBufs * sizeof(HeapMultiBuf_AddrPair));
            Memory_free(NULL, obj->bufsBySize, obj->numBufs * sizeof(HeapBuf_Object*));
            return;
    }
    
    /* 
     * If finalize is being called through a normal delete, rather than
     * through a failed create...
     */
     
    /* Delete all of the created HeapBufs */
    for (i = 0; i < obj->numBufs; i++) {
        HeapBuf_delete(&(obj->bufsBySize[i]));
    }
    
    /* Free the bufsByAddr and bufsBySize arrays. */
    Memory_free(NULL, obj->bufsByAddr, obj->numBufs * sizeof(HeapMultiBuf_AddrPair));
    Memory_free(NULL, obj->bufsBySize, obj->numBufs * sizeof(HeapBuf_Object*));
}
开发者ID:andreimironenko,项目名称:bios,代码行数:52,代码来源:HeapMultiBuf.c


示例20: Comm_create

/*
 *  ======== Comm_create ========
 */
Comm_Handle Comm_create(String queueName, Comm_Attrs *attrs)
{
    Comm_Obj   *comm;
    UInt32      commId;
    Char        commName[ MAXCOMMNAMELEN ];
    key_t       key;

    Assert_isTrue(curInit > 0, (Assert_Id)NULL);

    Log_print2(Diags_ENTRY, "[+E] Comm_create> "
            "Enter(queueName='%s', attrs=0x%x)", (IArg)queueName, (IArg)attrs);

    if (attrs == NULL) {
        attrs = &Comm_ATTRS;
    }

    if (queueName == NULL) {
        /* Generate a name to use */
        // TODO: Increment curCommId atomically
        commId = curCommId++;
        sprintf(commName, "queue_%lu_%u", Global_getProcessId(), (Uns)commId);
        key = nameToId(commName);
    }
    else {
        key = nameToId(queueName);
    }

    comm = (Comm_Obj *)Memory_alloc(NULL, sizeof(Comm_Obj), 0, NULL);
    if (comm == NULL) {
        return (NULL);
    }

    comm->type = attrs->type;

    if (comm->type == Comm_PEND) {
        ;
    }
    else if (comm->type == Comm_CALL) {
        comm->callHandle = attrs->callHandle;
        comm->callFxn    = attrs->callFxn;
    }
    else {
        Assert_isTrue(FALSE, (Assert_Id)NULL);  /* unknown Comm type */
    }

    /*
     * Create a new message queue id for the "name" key
     */
    if ((comm->id = msgget(key, IPC_CREAT | 0644)) < 0) {
        fprintf(stderr, "msgget key = 0x%x\n", key);
        perror("Comm_create:msgget");
        Memory_free(NULL, comm, sizeof(Comm_Obj));
        return (NULL);
    }

    Log_print1(Diags_EXIT, "[+X] Comm_create> return (0x%x)", (IArg)comm);

    return (comm);
}
开发者ID:andreimironenko,项目名称:codec-engine,代码行数:62,代码来源:Comm_posix.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ Menu函数代码示例发布时间:2022-05-30
下一篇:
C++ Memory_Free函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap