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


C++ ellAdd函数代码示例

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


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

示例1: offsetof

void
bufRxManager::receive(epicsUInt8* raw,unsigned int usedlen)
{
    /* CONTAINER doesn't work when the member is a pointer
     * because the GNU version's check isn't correct
    buffer *buf=CONTAINER(raw, buffer, data);
     */
    buffer *buf=(buffer*)((char*)(raw) - offsetof(buffer, data));

    if (usedlen>bsize())
        throw std::out_of_range("User admitted overflowing Rx buffer");
    buf->used=usedlen;

    if (usedlen==0) {
        // buffer returned w/o being used
        {
            SCOPED_LOCK(guard);
            ellAdd(&freebufs, &buf->node);
        }
        return;
    }

    {
        SCOPED_LOCK(guard);
        ellAdd(&usedbufs, &buf->node);
    }

    callbackRequest(&received_cb);
}
开发者ID:aderbenev,项目名称:mrfioc2,代码行数:29,代码来源:bufrxmgr.cpp

示例2: msgbufGetNode

static char *msgbufGetFree(int noConsoleMessage)
{
    msgNode *pnextSend;

    if (epicsMutexLock(pvtData.msgQueueLock) != epicsMutexLockOK)
        return 0;

    if ((ellCount(&pvtData.msgQueue) == 0) && pvtData.missedMessages) {
        int nchar;

        pnextSend = msgbufGetNode();
        nchar = sprintf(pnextSend->message,
            "errlog: %d messages were discarded\n", pvtData.missedMessages);
        pnextSend->length = nchar + 1;
        pvtData.missedMessages = 0;
        ellAdd(&pvtData.msgQueue, &pnextSend->node);
    }

    pvtData.pnextSend = pnextSend = msgbufGetNode();
    if (pnextSend) {
        pnextSend->noConsoleMessage = noConsoleMessage;
        pnextSend->length = 0;
        return pnextSend->message;  /* NB: msgQueueLock is still locked */
    }

    ++pvtData.missedMessages;
    epicsMutexUnlock(pvtData.msgQueueLock);
    return 0;
}
开发者ID:T-A-R-L-A,项目名称:EPICS-Base,代码行数:29,代码来源:errlog.c

示例3: createChannelCallFunction

static void createChannelCallFunction(const iocshArgBuf *args)
{
	drvM6802_taskConfig *ptaskConfig = NULL;
	drvM6802_channelConfig *pchannelConfig = NULL;
	char task_name[60];
	char channel_name[60];
	int channel_ID=0;

	if(args[0].sval) strcpy(task_name, args[0].sval);
	if(args[1].sval) channel_ID = strtoul(args[1].sval,NULL,0);
	if(args[2].sval) strcpy(channel_name, args[2].sval);

	ptaskConfig = find_taskConfig(task_name);
	if(!ptaskConfig) return;

	pchannelConfig = (drvM6802_channelConfig*) malloc(sizeof(drvM6802_channelConfig));
	if(!pchannelConfig) return;

	pchannelConfig->channelStatus = 0x0000;
	strcpy(pchannelConfig->chanName, channel_name);
	pchannelConfig->chanIndex = channel_ID;

	pchannelConfig->gain = INIT_GAIN;
	pchannelConfig->ptaskConfig = ptaskConfig;
	pchannelConfig->conversionTime_usec = 0.;

	ellAdd(ptaskConfig->pchannelConfig, &pchannelConfig->node);


#ifdef DEBUG
	epicsPrintf("createChannelCallFunction... ok\n");
#endif /* DEBUG */
	
	return;
}
开发者ID:Sangil-Lee,项目名称:RefCode,代码行数:35,代码来源:drvM6802.c

示例4: addAction

static void addAction(caLink *pca, short link_action)
{
    int callAdd;

    epicsMutexMustLock(workListLock);
    callAdd = (pca->link_action == 0);
    if (pca->link_action & CA_CLEAR_CHANNEL) {
        errlogPrintf("dbCa::addAction %d with CA_CLEAR_CHANNEL set\n",
            link_action);
        printLinks(pca);
        link_action = 0;
    }
    if (link_action & CA_CLEAR_CHANNEL) {
        if (++removesOutstanding >= removesOutstandingWarning) {
            errlogPrintf("dbCa::addAction pausing, %d channels to clear\n",
                removesOutstanding);
            printLinks(pca);
        }
        while (removesOutstanding >= removesOutstandingWarning) {
            epicsMutexUnlock(workListLock);
            epicsThreadSleep(1.0);
            epicsMutexMustLock(workListLock);
        }
    }
    pca->link_action |= link_action;
    if (callAdd)
        ellAdd(&workList, &pca->node);
    epicsMutexUnlock(workListLock);
    if (callAdd)
        epicsEventSignal(workListEvent);
}
开发者ID:T-A-R-L-A,项目名称:EPICS-Base,代码行数:31,代码来源:dbCa.c

示例5: epicsJobMove

int epicsJobMove(epicsJob *job, epicsThreadPool *newpool)
{
    epicsThreadPool *pool = job->pool;

    /* remove from current pool */
    if (pool) {
        epicsMutexMustLock(pool->guard);

        if (job->queued || job->running) {
            epicsMutexUnlock(pool->guard);
            return S_pool_jobBusy;
        }

        ellDelete(&pool->owned, &job->jobnode);

        epicsMutexUnlock(pool->guard);
    }

    pool = job->pool = newpool;

    /* add to new pool */
    if (pool) {
        epicsMutexMustLock(pool->guard);

        ellAdd(&pool->owned, &job->jobnode);

        epicsMutexUnlock(pool->guard);
    }

    return 0;
}
开发者ID:epicsdeb,项目名称:epics-base,代码行数:31,代码来源:poolJob.c

示例6: taskwdInsert

void taskwdInsert(epicsThreadId tid, TASKWDFUNC callback, void *usr)
{
    struct tNode *pt;
    struct mNode *pm;

    taskwdInit();
    if (tid == 0)
       tid = epicsThreadGetIdSelf();

    pt = &allocNode()->t;
    pt->tid = tid;
    pt->callback = callback;
    pt->usr = usr;
    pt->suspended = FALSE;

    epicsMutexMustLock(mLock);
    pm = (struct mNode *)ellFirst(&mList);
    while (pm) {
        if (pm->funcs->insert) {
            pm->funcs->insert(pm->usr, tid);
        }
        pm = (struct mNode *)ellNext(&pm->node);
    }
    epicsMutexUnlock(mLock);

    epicsMutexMustLock(tLock);
    ellAdd(&tList, (void *)pt);
    epicsMutexUnlock(tLock);
}
开发者ID:ukaea,项目名称:epics,代码行数:29,代码来源:taskwd.c

示例7: makePorts

/*
 * Driver initialisation at IOC startup (ecAsynInit)
 *
 * path - location of Unix Domain Socket, must match the scanner's
 * max_message - maximum size of messages between scanner and ioc
 *               This must be able to accommodate the configuration
 *               of the chain that is transferred from the scanner to
 *               the ioc.
 */
static void makePorts(char * path, int max_message)
{
    ENGINE_USER * usr = (ENGINE_USER *)callocMustSucceed
        (1, sizeof(ENGINE_USER), "can't allocate socket engine private data");
    ellInit(&usr->ports);
    usr->master = new ecMaster((char *)"MASTER0");
    ellAdd(&usr->ports, &usr->master->node);
    usr->config_ready = rtMessageQueueCreate(1, sizeof(int));
    // TODO - no assert for runtime errors, so what should we use to throw?
    assert(usr->config_ready != NULL);
    usr->config = (EC_CONFIG *)callocMustSucceed
        (1, sizeof(EC_CONFIG), "can't allocate chain config lists");
    usr->writeq = rtMessageQueueCreate(1, max_message);
    assert(usr->writeq != NULL);
    ENGINE * engine = new_engine(max_message);
    engine->path = strdup(path);
    engine->connect = client_connect;
    engine->on_connect = receive_config_on_connect;
    engine->send_message = ioc_send;
    engine->receive_message = ioc_receive;
    engine->usr = usr;
    engine_start(engine);

    new_timer(1000000000, usr->writeq, 0, MSG_HEARTBEAT);

    int ack;
    rtMessageQueueReceive(usr->config_ready, &ack, sizeof(int));

}
开发者ID:ronaldomercado,项目名称:ethercat,代码行数:38,代码来源:ecAsyn.cpp

示例8: epicsJobUnqueue

int epicsJobUnqueue(epicsJob *job)
{
    int ret = S_pool_jobIdle;
    epicsThreadPool *pool = job->pool;

    if (!pool)
        return S_pool_noPool;

    epicsMutexMustLock(pool->guard);

    assert(!job->dead);

    if (job->queued) {
        if (!job->running) {
            ellDelete(&pool->jobs, &job->jobnode);
            ellAdd(&pool->owned, &job->jobnode);
        }
        job->queued = 0;
        ret = 0;
    }

    epicsMutexUnlock(pool->guard);

    return ret;
}
开发者ID:epicsdeb,项目名称:epics-base,代码行数:25,代码来源:poolJob.c

示例9: asynMotorController

motorSimController::motorSimController(const char *portName, int numAxes, int priority, int stackSize)
  :  asynMotorController(portName, numAxes, NUM_SIM_CONTROLLER_PARAMS, 
                         asynInt32Mask | asynFloat64Mask, 
                         asynInt32Mask | asynFloat64Mask,
                         ASYN_CANBLOCK | ASYN_MULTIDEVICE, 
                         1, // autoconnect
                         priority, stackSize)
{
  int axis;
  motorSimControllerNode *pNode;
  
  if (!motorSimControllerListInitialized) {
    motorSimControllerListInitialized = 1;
    ellInit(&motorSimControllerList);
  }
  
  // We should make sure this portName is not already in the list */
  pNode = (motorSimControllerNode*) calloc(1, sizeof(motorSimControllerNode));
  pNode->portName = epicsStrDup(portName);
  pNode->pController = this;
  ellAdd(&motorSimControllerList, (ELLNODE *)pNode);

  if (numAxes < 1 ) numAxes = 1;
  numAxes_ = numAxes;
  this->movesDeferred_ = 0;
  for (axis=0; axis<numAxes; axis++) {
    new motorSimAxis(this, axis, DEFAULT_LOW_LIMIT, DEFAULT_HI_LIMIT, DEFAULT_HOME, DEFAULT_START);
    setDoubleParam(axis, this->motorPosition_, DEFAULT_START);
  }

  this->motorThread_ = epicsThreadCreate("motorSimThread", 
                                         epicsThreadPriorityLow,
                                         epicsThreadGetStackSize(epicsThreadStackMedium),
                                         (EPICSTHREADFUNC) motorSimTaskC, (void *) this);
}
开发者ID:dchabot,项目名称:motor-synapps,代码行数:35,代码来源:motorSimDriver.cpp

示例10: start_routine

static void * start_routine(void *arg)
{
    epicsThreadOSD *pthreadInfo = (epicsThreadOSD *)arg;
    int status;
    int oldtype;
    sigset_t blockAllSig;
 
    sigfillset(&blockAllSig);
    pthread_sigmask(SIG_SETMASK,&blockAllSig,NULL);
    status = pthread_setspecific(getpthreadInfo,arg);
    checkStatusQuit(status,"pthread_setspecific","start_routine");
    status = pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS,&oldtype);
    checkStatusQuit(status,"pthread_setcanceltype","start_routine");
    status = mutexLock(&listLock);
    checkStatusQuit(status,"pthread_mutex_lock","start_routine");
    ellAdd(&pthreadList,&pthreadInfo->node);
    pthreadInfo->isOnThreadList = 1;
    status = pthread_mutex_unlock(&listLock);
    checkStatusQuit(status,"pthread_mutex_unlock","start_routine");

    (*pthreadInfo->createFunc)(pthreadInfo->createArg);

    epicsExitCallAtThreadExits ();

    free_threadInfo(pthreadInfo);
    return(0);
}
开发者ID:T-A-R-L-A,项目名称:EPICS-Base,代码行数:27,代码来源:osdThread.c

示例11: devInsertAddress

/*
 *      devInsertAddress()
 */
static void devInsertAddress(
ELLLIST     *pRangeList,
rangeItem   *pNewRange)
{
    rangeItem   *pBefore;
    rangeItem   *pAfter;

    epicsMutexMustLock(addrListLock);
    pAfter = (rangeItem *) ellFirst (pRangeList);
    while (pAfter) {
        if (pNewRange->end < pAfter->begin) {
            break;
        }
        pAfter = (rangeItem *) ellNext (&pAfter->node);
    }

    if (pAfter) {
        pBefore = (rangeItem *) ellPrevious (&pAfter->node);
        ellInsert (pRangeList, &pBefore->node, &pNewRange->node);
    }
    else {
        ellAdd (pRangeList, &pNewRange->node);
    }
    epicsMutexUnlock(addrListLock);
}
开发者ID:ukaea,项目名称:epics,代码行数:28,代码来源:devLibVME.c

示例12: callbackGetUser

void
bufRxManager::received(CALLBACK* cb)
{
    void *vptr;
    callbackGetUser(vptr,cb);
    bufRxManager &self=*static_cast<bufRxManager*>(vptr);

    SCOPED_LOCK2(self.guard, G);

    while(true) {
        ELLNODE *node=ellGet(&self.usedbufs);

        if (!node)
            break;
        buffer *buf=CONTAINER(node, buffer, node);

        G.unlock();

        for(ELLNODE *cur=ellFirst(&self.dispatch); cur; cur=ellNext(cur)) {
            listener *action=CONTAINER(cur, listener, node);
            (action->fn)(action->fnarg, 0, buf->used, buf->data);
        }

        G.lock();

        ellAdd(&self.freebufs, &buf->node);
    };
}
开发者ID:aderbenev,项目名称:mrfioc2,代码行数:28,代码来源:bufrxmgr.cpp

示例13: dbRegisterFilter

void dbRegisterFilter(const char *name, const chFilterIf *fif, void *puser)
{
    GPHENTRY *pgph;
    chFilterPlugin *pfilt;

    if (!pdbbase) {
        printf("dbRegisterFilter: pdbbase not set!\n");
        return;
    }

    pgph = gphFind(pdbbase->pgpHash, name, &pdbbase->filterList);
    if (pgph)
        return;

    pfilt = dbCalloc(1, sizeof(chFilterPlugin));
    pfilt->name = epicsStrDup(name);
    pfilt->fif = fif;
    pfilt->puser = puser;

    ellAdd(&pdbbase->filterList, &pfilt->node);
    pgph = gphAdd(pdbbase->pgpHash, pfilt->name, &pdbbase->filterList);
    if (!pgph) {
        free((void *) pfilt->name);
        free(pfilt);
        printf("dbRegisterFilter: gphAdd failed\n");
        return;
    }
    pgph->userPvt = pfilt;
}
开发者ID:epicsdeb,项目名称:epics-base,代码行数:29,代码来源:dbChannel.c

示例14: freeNode

static void freeNode(union twdNode *pn)
{
    VALGRIND_MEMPOOL_FREE(&fList, pn);
    VALGRIND_MEMPOOL_ALLOC(&fList, pn, sizeof(ELLNODE));
    epicsMutexMustLock(fLock);
    ellAdd(&fList, (void *)pn);
    epicsMutexUnlock(fLock);
}
开发者ID:ukaea,项目名称:epics,代码行数:8,代码来源:taskwd.c

示例15: notifyCleanup

static void notifyCleanup(processNotify *ppn)
{
    notifyPvt *pnotifyPvt = (notifyPvt *) ppn->pnotifyPvt;

    pnotifyPvt->state = notifyNotActive;
    ellAdd(&pnotifyGlobal->freeList, &pnotifyPvt->node);
    ppn->pnotifyPvt = 0;
}
开发者ID:epicsdeb,项目名称:epics-base,代码行数:8,代码来源:dbNotify.c


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