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


C++ epicsMutexMustLock函数代码示例

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


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

示例1: ss_read_buffer_static

/*
 * ss_read_buffer_static() - static version of ss_read_buffer.
 * This is to enable inlining in the for loop in ss_read_all_buffer.
 */
static void ss_read_buffer_static(SSCB *ss, CHAN *ch, boolean dirty_only)
{
	char *val = valPtr(ch,ss);
	char *buf = bufPtr(ch);
	ptrdiff_t nch = chNum(ch);
	/* Must take dbCount for db channels, else we overwrite
	   elements we didn't get */
	size_t count = ch->dbch ? ch->dbch->dbCount : ch->count;
	size_t var_size = ch->type->size * count;

	if (!ss->dirty[nch] && dirty_only)
		return;

	epicsMutexMustLock(ch->varLock);

	DEBUG("ss %s: before read %s", ss->ssName, ch->varName);
	print_channel_value(DEBUG, ch, val);

	memcpy(val, buf, var_size);
	if (ch->dbch)
	{
		/* structure copy */
		ss->metaData[nch] = ch->dbch->metaData;
	}

	DEBUG("ss %s: after read %s", ss->ssName, ch->varName);
	print_channel_value(DEBUG, ch, val);

	ss->dirty[nch] = FALSE;

	epicsMutexUnlock(ch->varLock);
}
开发者ID:ukaea,项目名称:epics,代码行数:36,代码来源:seq_task.c

示例2: ss_write_buffer

/*
 * ss_write_buffer() - Copy given value and meta data
 * to shared buffer. In safe mode, if dirtify is TRUE then
 * set dirty flag for each state set.
 */
void ss_write_buffer(CHAN *ch, void *val, PVMETA *meta, boolean dirtify)
{
	PROG *sp = ch->prog;
	char *buf = bufPtr(ch);		/* shared buffer */
	/* Must use dbCount for db channels, else we overwrite
	   elements we didn't get */
	size_t count = ch->dbch ? ch->dbch->dbCount : ch->count;
	size_t var_size = ch->type->size * count;
	ptrdiff_t nch = chNum(ch);
	unsigned nss;

	epicsMutexMustLock(ch->varLock);

	DEBUG("ss_write_buffer: before write %s", ch->varName);
	print_channel_value(DEBUG, ch, buf);

	memcpy(buf, val, var_size);
	if (ch->dbch && meta)
		/* structure copy */
		ch->dbch->metaData = *meta;

	DEBUG("ss_write_buffer: after write %s", ch->varName);
	print_channel_value(DEBUG, ch, buf);

	if (optTest(sp, OPT_SAFE) && dirtify)
		for (nss = 0; nss < sp->numSS; nss++)
			sp->ss[nss].dirty[nch] = TRUE;

	epicsMutexUnlock(ch->varLock);
}
开发者ID:ukaea,项目名称:epics,代码行数:35,代码来源:seq_task.c

示例3: seq_pvGetQ

/*
 * Get value from a queued PV.
 */
epicsShareFunc boolean epicsShareAPI seq_pvGetQ(SS_ID ss, VAR_ID varId)
{
	SPROG	*sp = ss->sprog;
	CHAN	*ch = sp->chan + varId;
	void	*var = valPtr(ch,ss);
	EV_ID	ev_flag = ch->syncedTo;
	PVMETA	*meta = metaPtr(ch,ss);
	boolean	was_empty;
	struct getq_cp_arg arg = {ch, var, meta};

	if (!ch->queue)
	{
		errlogSevPrintf(errlogMajor,
			"pvGetQ(%s): user error (variable not queued)\n",
			ch->varName
		);
		return FALSE;
	}

	was_empty = seqQueueGetF(ch->queue, getq_cp, &arg);

	if (ev_flag)
	{
		epicsMutexMustLock(sp->programLock);
		/* If queue is now empty, clear the event flag */
		if (seqQueueIsEmpty(ch->queue))
		{
			bitClear(sp->evFlags, ev_flag);
		}
		epicsMutexUnlock(sp->programLock);
	}

	return (!was_empty);
}
开发者ID:A2-Collaboration,项目名称:epics,代码行数:37,代码来源:seq_if.c

示例4: devLibPCIUse

epicsShareFunc
int
devLibPCIUse(const char* use)
{
    ELLNODE *cur;
    devLibPCI *drv;

    if (!use)
        use="native";

    epicsThreadOnce(&devPCIReg_once, &regInit, NULL);

    epicsMutexMustLock(pciDriversLock);

    if (pdevLibPCI) {
        epicsMutexUnlock(pciDriversLock);
        errlogPrintf("PCI bus driver already selected. Can't change selection\n");
        return 1;
    }

    for(cur=ellFirst(&pciDrivers); cur; cur=ellNext(cur)) {
        drv=CONTAINER(cur, devLibPCI, node);
        if (strcmp(drv->name, use)==0) {
            pdevLibPCI = drv;
            epicsMutexUnlock(pciDriversLock);
            return 0;
        }
    }
    epicsMutexUnlock(pciDriversLock);
    errlogPrintf("PCI bus driver '%s' not found\n",use);
    return 1;
}
开发者ID:paulscherrerinstitute,项目名称:devlib2,代码行数:32,代码来源:devLibPCI.c

示例5: accessRightsCallback

static void accessRightsCallback(struct access_rights_handler_args arg)
{
    caLink *pca = (caLink *)ca_puser(arg.chid);
    struct link	*plink;
    struct pv_link *ppv_link;
    dbCommon *precord;

    assert(pca);
    if (ca_state(pca->chid) != cs_conn)
        return; /* connectionCallback will handle */
    epicsMutexMustLock(pca->lock);
    plink = pca->plink;
    if (!plink) goto done;
    pca->hasReadAccess = ca_read_access(arg.chid);
    pca->hasWriteAccess = ca_write_access(arg.chid);
    if (pca->hasReadAccess && pca->hasWriteAccess) goto done;
    ppv_link = &plink->value.pv_link;
    precord = ppv_link->precord;
    if (precord &&
        ((ppv_link->pvlMask & pvlOptCP) ||
         ((ppv_link->pvlMask & pvlOptCPP) && precord->scan == 0)))
        scanOnce(precord);
done:
    epicsMutexUnlock(pca->lock);
}
开发者ID:T-A-R-L-A,项目名称:EPICS-Base,代码行数:25,代码来源:dbCa.c

示例6: deleteFromList

static void deleteFromList(struct dbCommon *precord, scan_list *psl)
{
    scan_element *pse;

    epicsMutexMustLock(psl->lock);
    pse = precord->spvt;
    if (pse == NULL) {
        epicsMutexUnlock(psl->lock);
        errlogPrintf("dbScan: Tried to delete record from wrong scan list!\n"
            "\t%s.SPVT = NULL, but psl = %p\n",
            precord->name, (void *)psl);
        return;
    }
    if (pse->pscan_list != psl) {
        epicsMutexUnlock(psl->lock);
        errlogPrintf("dbScan: Tried to delete record from wrong scan list!\n"
            "\t%s.SPVT->pscan_list = %p but psl = %p\n",
            precord->name, (void *)pse, (void *)psl);
        return;
    }
    pse->pscan_list = NULL;
    ellDelete(&psl->list, (void *)pse);
    psl->modified = TRUE;
    epicsMutexUnlock(psl->lock);
}
开发者ID:T-A-R-L-A,项目名称:EPICS-Base,代码行数:25,代码来源:dbScan.c

示例7: writeFloat64

/****************************************************************************
 * Define private interface asynFloat64 methods
 ****************************************************************************/
static asynStatus writeFloat64(void* ppvt,asynUser* pasynUser,epicsFloat64 value)
{
    int addr,status;
    const char* pcmd;
    char outBuf[BUFFER_SIZE];
    Port* pport = (Port*)ppvt;

    asynPrint(pasynUser,ASYN_TRACE_FLOW,"drvAsynColby::writeFloat64 %s:\n",pport->myport);

    if( pasynManager->getAddr(pasynUser,&addr)) return( asynError );

    switch( addr )
    {
    case 0:
        pcmd = "DEL";
        break;
    case 4:
        pcmd = "STEP";
        break;
    default:
        return( asynError );
    }

    epicsMutexMustLock(pport->syncLock);
    sprintf(outBuf,"%s %-.3f %s",pcmd,value,pport->units);
    status = writeOnly(pport->pasynUser,outBuf,pport->iface);
    epicsMutexUnlock(pport->syncLock);

    asynPrint(pasynUser,ASYN_TRACEIO_FILTER,"drvAsynColby::writeFloat64 %s: asyn - 0x%8.8X, addr - %d, value - %-.3f\n",pport->myport,pasynUser,addr,value);

    if( status ) return( asynError ); else return( asynSuccess );
}
开发者ID:A2-Collaboration,项目名称:epics,代码行数:35,代码来源:drvAsynColby.cpp

示例8: read_delta

static long read_delta(aiRecord* prec)
{
    epicsMutexMustLock(ntpShm.ntplock);
    double val = 0.0;
    if(ntpShm.lastValid)
        val = epicsTimeDiffInSeconds(&ntpShm.lastStamp, &ntpShm.lastRx);
    else
        recGblSetSevr(prec, READ_ALARM, INVALID_ALARM);
    if(prec->tse==epicsTimeEventDeviceTime) {
        prec->time = ntpShm.lastStamp;
    }
    epicsMutexUnlock(ntpShm.ntplock);

    if(prec->linr==menuConvertLINEAR){
        val-=prec->eoff;
        if(prec->eslo!=0)
            val/=prec->eslo;
    }
    val-=prec->aoff;
    if(prec->aslo!=0)
        val/=prec->aslo;
    prec->val = val;
    prec->udf = !isfinite(val);

    return 2;
}
开发者ID:paulscherrerinstitute,项目名称:mrfioc2,代码行数:26,代码来源:ntpShm.cpp

示例9: read_fail

static long read_fail(longinRecord* prec)
{
    epicsMutexMustLock(ntpShm.ntplock);
    prec->val = ntpShm.numFail;
    epicsMutexUnlock(ntpShm.ntplock);
    return 0;
}
开发者ID:paulscherrerinstitute,项目名称:mrfioc2,代码行数:7,代码来源:ntpShm.cpp

示例10: incFail

static void incFail()
{
    epicsMutexMustLock(ntpShm.ntplock);
    ntpShm.lastValid = false;
    ntpShm.numFail++;
    epicsMutexUnlock(ntpShm.ntplock);
}
开发者ID:paulscherrerinstitute,项目名称:mrfioc2,代码行数:7,代码来源:ntpShm.cpp

示例11: dbstat

/* print list of stopped records, and breakpoints set in locksets */
long epicsShareAPI dbstat(void)
{
  struct LS_LIST *pnode;
  struct BP_LIST *pbl;
  struct EP_LIST *pqe;
  epicsTimeStamp time;

  epicsMutexMustLock(bkpt_stack_sem);

  epicsTimeGetCurrent(&time);

 /*
  *  Traverse list, reporting stopped records
  */
  pnode = (struct LS_LIST *) ellFirst(&lset_stack);
  while (pnode != NULL) {
    if (pnode->precord != NULL) {

       printf("LSet: %lu  Stopped at: %-28.28s  #B: %5.5d  T: %p\n",
             pnode->l_num, pnode->precord->name, ellCount(&pnode->bp_list), pnode->taskid);

      /* for each entrypoint detected, print out entrypoint statistics */
       pqe = (struct EP_LIST *) ellFirst(&pnode->ep_queue); 
       while (pqe != NULL) {
          double diff = epicsTimeDiffInSeconds(&time,&pqe->time);
          if (diff) {
             printf("             Entrypoint: %-28.28s  #C: %5.5lu  C/S: %7.1f\n",
                 pqe->entrypoint->name, pqe->count,diff);
          }
          pqe = (struct EP_LIST *) ellNext((ELLNODE *)pqe);
       }
    }
    else {
       printf("LSet: %lu                                            #B: %5.5d  T: %p\n",
         pnode->l_num, ellCount(&pnode->bp_list), pnode->taskid);
    }

   /*
    *  Print out breakpoints set in the lock set
    */
    pbl = (struct BP_LIST *) ellFirst(&pnode->bp_list);
    while (pbl != NULL) {
        printf("             Breakpoint: %-28.28s", pbl->precord->name);

       /* display auto print flag */
        if (pbl->precord->bkpt & BKPT_PRINT_MASK)
           printf(" (ap)\n");
        else
           printf("\n");

        pbl = (struct BP_LIST *) ellNext((ELLNODE *)pbl);
    }

    pnode = (struct LS_LIST *) ellNext((ELLNODE *)pnode);
  }

  epicsMutexUnlock(bkpt_stack_sem);
  return(0);
}
开发者ID:ISISComputingGroup,项目名称:EPICS-base,代码行数:60,代码来源:dbBkpt.c

示例12: dbStateSet

void dbStateSet(dbStateId id)
{
    if (!id)
        return;
    epicsMutexMustLock(id->lock);
    id->status = 1;
    epicsMutexUnlock(id->lock);
}
开发者ID:A2-Collaboration,项目名称:epics,代码行数:8,代码来源:dbState.c

示例13: dbStateClear

void dbStateClear(dbStateId id)
{
    if (!id)
        return;
    epicsMutexMustLock(id->lock);
    id->status = 0;
    epicsMutexUnlock(id->lock);
}
开发者ID:A2-Collaboration,项目名称:epics,代码行数:8,代码来源:dbState.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: generalTimeHighestCurrentName

const char * generalTimeHighestCurrentName(void)
{
    gtProvider *ptp;

    epicsMutexMustLock(gtPvt.timeListLock);
    ptp = (gtProvider *)ellFirst(&gtPvt.timeProviders);
    epicsMutexUnlock(gtPvt.timeListLock);
    return ptp ? ptp->name : NULL;
}
开发者ID:zlxmsu,项目名称:TestEpics,代码行数:9,代码来源:epicsGeneralTime.c


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