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

C++ epicsThreadSleep函数代码示例

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

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



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

示例1: strlen

/** Writes a string to the controller.
  * \param[in] output The string to be written.
  * \param[in] timeout Timeout before returning an error.*/
asynStatus AG_CONEXController::writeCONEX(const char *output, double timeout)
{
  size_t nwrite;
  asynStatus status;
  // const char *functionName="writeCONEX";
  
  status = pasynOctetSyncIO->write(pasynUserController_, output,
                                   strlen(output), timeout, &nwrite);
                                   
  // On Linux it seems to be necessary to delay a short time between writes
  #ifdef linux
  epicsThreadSleep(LINUX_WRITE_DELAY);
  #endif
                                  
  return status ;
}
开发者ID:ISISComputingGroup,项目名称:EPICS-motor,代码行数:19,代码来源:AG_CONEX.cpp


示例2: main

int main(int argc,char *argv[])
{
	int i, j;
	extern short DEBUG;
	short daemon;
	char stcmd[256];

	/* Need to catch hang up signal to make sure semaphores are
	   cleaned up properly */
	SetSigShutdownHandler();

	daemon = 0;
	if(argc>=2) {    
		snprintf( stcmd, 255, "%s", argv[1]);
		/* parse command line args for crate and IP */
		j = 0;
		for( i = 2; i < argc; i++) {
		  if( strcmp( argv[i], "-D") == 0) {
		    i++;
		    DEBUG = atoi( argv[i]);
		  } else if( strcmp( argv[i], "-d") == 0) {
		    daemon = 1;
		  }
		}
	}
	else
	{
		printf( "Syntax: hvcontrol <st.cmd> [-c <name>@<hostname>[:<slotlist>]] [-d] [-D <debuglevel>]\n");
		printf( "        where <slotlist> = comma and dash separated list of slots.\n");
		printf( "              -d = run in daemon mode\n");
		printf( "              <debuglevel> = 0 no messages\n");
		printf( "              <debuglevel> = 10 all available messages\n");
	}

	if (strlen(stcmd)>0)	iocsh(stcmd);

	if (daemon)	{
		for(;;)
			epicsThreadSleep(1.0);
	} else {
		iocsh(NULL);
	}
	Shutdown();

	return(0);
}
开发者ID:JeffersonLab,项目名称:hps-epics,代码行数:46,代码来源:HVCAENx527Main.cpp


示例3: controlThreadFunc

static void controlThreadFunc(void *param)
{

	drvM6802_taskConfig *ptaskConfig = (drvM6802_taskConfig*) param;
	drvM6802_controlThreadConfig *pcontrolThreadConfig;
	controlThreadQueueData		queueData;

	while( !ptaskConfig->pcontrolThreadConfig ) epicsThreadSleep(.1);
	pcontrolThreadConfig = (drvM6802_controlThreadConfig*) ptaskConfig->pcontrolThreadConfig;


	epicsPrintf("task launching: %s thread for %s task\n",pcontrolThreadConfig->threadName, ptaskConfig->taskName);

	while(TRUE) {
		EXECFUNCQUEUE            pFunc;
		execParam                *pexecParam;
		struct dbCommon          *precord;
		struct rset              *prset;

		drvM6802_taskConfig    *ptaskConfig;

		epicsMessageQueueReceive(pcontrolThreadConfig->threadQueueId,
				         (void*) &queueData,
					 sizeof(controlThreadQueueData));

		pFunc      = queueData.pFunc;
	        pexecParam = &queueData.param;	
		precord    = (struct dbCommon*) pexecParam->precord;
		prset      = (struct rset*) precord->rset;
		ptaskConfig = (drvM6802_taskConfig *) pexecParam->ptaskConfig;

		if(!pFunc) continue;
		else pFunc(pexecParam);

		if(!precord) continue;


		dbScanLock(precord);
		(*prset->process)(precord); 
		dbScanUnlock(precord);
	}


	return;
}
开发者ID:Sangil-Lee,项目名称:RefCode,代码行数:45,代码来源:drvM6802.c


示例4: strcpy

/** Get Acquition Status */ 
epicsInt32 mythen::getStatus()
{
    epicsInt32 detStatus;
    int aux;

    strcpy(outString_, "-get status");
    writeReadMeter();
    aux = stringToInt32(this->inString_);
    int m_status =  aux & 1;          // Acquire running status (non-zero)
    int t_status = aux & (1<<3);      // Waiting for trigger (non-zero)        
    int d_status = aux & (1<<16);     // No Data Available when not zero
    int triggerWaitCnt=0;
    double triggerWait;
    
    //printf("Mythen Status - M:%d\tT:%d\tD:%d\n",m_status,t_status, d_status);
    
    if (m_status || !d_status ) { 
      detStatus = ADStatusAcquire;
      
      triggerWaitCnt=0;
      //Waits for Trigger for increaseing amount of time for a total of almost 1 minute
      while ((t_status ) && (triggerWaitCnt<MAX_TRIGGER_TIMEOUT_COUNT)) {
        triggerWait = 0.0001*pow(10.0,((double)(triggerWaitCnt/10)+1));
        //Wait
        epicsThreadSleep(triggerWait);
        //Check again
        strcpy(outString_, "-get status");
        writeReadMeter();
        aux = stringToInt32(this->inString_);
        t_status = aux & (1<<3);       
        d_status = aux & (1<<16);     
        triggerWaitCnt++;
        
      }
      
      if (!d_status)
        detStatus = ADStatusReadout;
      if (triggerWaitCnt==MAX_TRIGGER_TIMEOUT_COUNT)
        detStatus = ADStatusError;
    }
    else
      detStatus = ADStatusIdle;
    
    return detStatus;
}
开发者ID:jsullivan-anl,项目名称:ADMythen,代码行数:46,代码来源:mythen.cpp


示例5: sprintf

asynStatus AG_CONEXAxis::home(double minVelocity, double maxVelocity, double acceleration, int forwards)
{
  asynStatus status;
  //static const char *functionName = "AG_CONEXAxis::home";

  // Must go to unreferenced state to home
  sprintf(pC_->outString_, "%dRS", pC_->controllerID_);
  status = pC_->writeCONEX();
  epicsThreadSleep(1.0);

  // The CONEX-CC supports home velocity, but only by going to Configuration state (PW1) 
  // and writing to non-volatile memory with the OH command.
  // This is time-consuming and can only be done a limited number of times so we don't do it here.

  sprintf(pC_->outString_, "%dOR", pC_->controllerID_);
  status = pC_->writeCONEX();
  return status;
}
开发者ID:ISISComputingGroup,项目名称:EPICS-motor,代码行数:18,代码来源:AG_CONEX.cpp


示例6: vxStats_busyloop

void
vxStats_busyloop(unsigned busyperc)
{
    epicsTimeStamp then, now;
    double         fac = vxStats_busyloop_period/(double)100.0;

    if ( busyperc > 100 )
        busyperc = 100;

    while ( vxStats_busyloop_run ) {
        epicsTimeGetCurrent(&then);
        do {
            epicsTimeGetCurrent(&now);
        } while ( epicsTimeDiffInSeconds(&now,&then) < (double)busyperc*fac );

        epicsThreadSleep((double)(100-busyperc)*fac);
    }
}
开发者ID:timmmooney,项目名称:iocStats,代码行数:18,代码来源:devIocStatsTest.c


示例7: testcancel

static
void testcancel(void)
{
    epicsJob *job[2];
    epicsThreadPool *pool;
    testOk1((pool=epicsThreadPoolCreate(NULL))!=NULL);
    if(!pool)
        return;

    cancel[0]=epicsEventCreate(epicsEventEmpty);
    cancel[1]=epicsEventCreate(epicsEventEmpty);

    testOk1((job[0]=epicsJobCreate(pool, &neverrun, EPICSJOB_SELF))!=NULL);
    testOk1((job[1]=epicsJobCreate(pool, &toolate, EPICSJOB_SELF))!=NULL);

    /* freeze */
    epicsThreadPoolControl(pool, epicsThreadPoolQueueRun, 0);

    testOk1(epicsJobUnqueue(job[0])==S_pool_jobIdle); /* not queued yet */

    epicsJobQueue(job[0]);
    testOk1(epicsJobUnqueue(job[0])==0);
    testOk1(epicsJobUnqueue(job[0])==S_pool_jobIdle);

    epicsThreadSleep(0.01);
    epicsJobQueue(job[0]);
    testOk1(epicsJobUnqueue(job[0])==0);
    testOk1(epicsJobUnqueue(job[0])==S_pool_jobIdle);

    epicsThreadPoolControl(pool, epicsThreadPoolQueueRun, 1);

    epicsJobQueue(job[1]); /* actually let it run this time */

    epicsEventMustWait(cancel[0]);
    testOk1(epicsJobUnqueue(job[0])==S_pool_jobIdle);
    epicsEventSignal(cancel[1]);

    epicsThreadPoolDestroy(pool);
    epicsEventDestroy(cancel[0]);
    epicsEventDestroy(cancel[1]);

    testOk1(shouldneverrun==0);
    testOk1(numtoolate==1);
}
开发者ID:epicsdeb,项目名称:epics-base,代码行数:44,代码来源:epicsThreadPoolTest.c


示例8: lock

/** Array generation ask that runs as a separate thread.  When the P_RunStop parameter is set to 1
  * it periodically generates a burst of arrays. */
void testArrayRingBuffer::arrayGenTask(void)
{
    double loopDelay;
    int runStop; 
    int i, j;
    int burstLength;
    double burstDelay;
    int maxArrayLength;
    int arrayLength;
    
    lock();
    /* Loop forever */ 
    getIntegerParam(P_MaxArrayLength, &maxArrayLength);   
    while (1) {
        getDoubleParam(P_LoopDelay, &loopDelay);
        getDoubleParam(P_BurstDelay, &burstDelay);
        getIntegerParam(P_RunStop, &runStop);
        // Release the lock while we wait for a command to start or wait for updateTime
        unlock();
        if (runStop) epicsEventWaitWithTimeout(eventId_, loopDelay);
        else         (void)epicsEventWait(eventId_);
        // Take the lock again
        lock(); 
        /* runStop could have changed while we were waiting */
        getIntegerParam(P_RunStop, &runStop);
        if (!runStop) continue;
        getIntegerParam(P_ArrayLength, &arrayLength);
        if (arrayLength > maxArrayLength) {
            arrayLength = maxArrayLength;
            setIntegerParam(P_ArrayLength, arrayLength);
        }
        getIntegerParam(P_BurstLength, &burstLength);
        for (i=0; i<burstLength; i++) {
            for (j=0; j<arrayLength; j++) {
                pData_[j] = i;
            }
            setIntegerParam(P_ScalarData, i);
            callParamCallbacks();
            doCallbacksInt32Array(pData_, arrayLength, P_ArrayData, 0);
            if (burstDelay > 0.0) 
                epicsThreadSleep(burstDelay);
        }
    }
}
开发者ID:FreddieAkeroyd,项目名称:asyn,代码行数:46,代码来源:testArrayRingBuffer.cpp


示例9: drvACQ196_ARM_enable

int drvACQ196_ARM_enable(ST_STD_device *pSTDdev)
{

	if(pSTDdev->StatusDev & TASK_ARM_ENABLED ) 
	{
		printf("\n>>> drvACQ196_ARM_enable : ADC already run \n");
		return WR_ERROR;
	}

	acq196_set_ABORT(pSTDdev);
	epicsThreadSleep(0.1);

	acq196_set_ARM(pSTDdev);
	
	pSTDdev->StatusDev &= ~TASK_SYSTEM_IDLE;
	pSTDdev->StatusDev |= TASK_ARM_ENABLED;

	return WR_OK;
}
开发者ID:Sangil-Lee,项目名称:RefCode,代码行数:19,代码来源:PCI_drvACQ196.c


示例10: readdjob

static void readdjob(void *arg, epicsJobMode mode)
{
    readdPriv *priv=arg;
    testOk1(mode==epicsJobModeRun||mode==epicsJobModeCleanup);
    if(mode==epicsJobModeCleanup)
        return;
    testOk1(priv->inprogress==0);
    testDiag("count==%u", priv->count);

    if(priv->count--) {
        priv->inprogress=1;
        epicsJobQueue(priv->job);
        epicsThreadSleep(0.05);
        priv->inprogress=0;
    }else{
        epicsEventSignal(priv->done);
        epicsJobDestroy(priv->job);
    }
}
开发者ID:epicsdeb,项目名称:epics-base,代码行数:19,代码来源:epicsThreadPoolTest.c


示例11: main

//==============================================================================
//
int main () {
   std::cout << "test abstract client user starting ("
             << ACAI_VERSION_STRING << ")\n\n";

   ACAI::Client::initialise ();

   ClientUser* user = new ClientUser ();

   TestClient* t1 = new TestClient ("T1");
   TestClient* t2 = new TestClient ("T2");
   TestClient* t3 = new TestClient ("T3");
   TestClient* t4 = new TestClient ("T4");

   user->registerClient (t1);
   user->registerClient (t2);
   user->registerClient (t3);
   std::cout << "\n";

   std::cout << "open registered clients\n";
   user->openRegisteredChannels();
   std::cout << "registered clients opened\n";

   std::cout << "open T4 client\n";
   t4->openChannel();
   std::cout << "T4 client opened\n";

   bool ok = user->waitAllRegisteredChannelsReady (2.0, 0.1);
   std::cout << "all channels open " << (ok ? "yes" : "no") <<  "\n";

   for (int t = 0; t < 500; t++) {
      epicsThreadSleep (0.02);   // 20mSec
      ACAI::Client::poll ();     // call back function invoked from here
   }

   std::cout << "close registered clients\n";
   user->closeRegisteredChannels();

   delete user;

   ACAI::Client::finalise();
   std::cout << "\ntest abstract client user complete\n";
   return 0;
}
开发者ID:andrewstarritt,项目名称:acai,代码行数:45,代码来源:test_abstract_user.cpp


示例12: devAdmin_BO_SYS_RUN

static void devAdmin_BO_SYS_RUN(ST_execParam *pParam)
{
	ST_ADMIN *pAdminCfg = drvAdmin_get_AdminPtr();
	struct dbCommon *precord = pParam->precord;
	ST_STD_device *pSTDdev = (ST_STD_device*) ellFirst(pAdminCfg->pList_DeviceTask);

	/**********************************************
		user add here modified code. 
	***********************************************/
	if( (int)pParam->setValue == 1 ) /* command to run  */
	{
		if( admin_check_Run_condition()  == WR_ERROR) 
			return;

		/* direct call to sub-device.. for status notify immediately */
		while(pSTDdev) 
		{
			pSTDdev->StatusDev &= ~TASK_ARM_ENABLED;
			pSTDdev->StatusDev |= TASK_DAQ_STARTED;

			pSTDdev = (ST_STD_device*) ellNext(&pSTDdev->node);
		}

		epicsThreadSleep(0.3);
	}
	else 
	{
#if 0	/* do nothing... 'cause aleady done in sub devices */	
		if( admin_check_Stop_condition()  == WR_ERROR) 
			return;

		/* do something, if you need */
		while(pSTDdev) 
		{
			drvACQ196_RUN_stop(pSTDdev);

			pSTDdev = (ST_STD_device*) ellNext(&pSTDdev->node);
		}
#endif
	}
	notify_refresh_admin_status();
	epicsPrintf("%s: %s: %d \n", pAdminCfg->taskName, precord->name, (int)pParam->setValue);
}
开发者ID:Sangil-Lee,项目名称:RefCode,代码行数:43,代码来源:sfwAdminBody.c


示例13: main

int main(int argc,char *argv[])
{
	int i, j;
	short daemon;
	char stcmd[256];

	/* Need to catch hang up signal to make sure semaphores are
	   cleaned up properly */
	SetSigShutdownHandler();

	daemon = 0;
	if(argc>=2) {    
		snprintf( stcmd, 255, "%s", argv[1]);
		j = 0;
		for( i = 2; i < argc; i++) {
		  if( strcmp( argv[i], "-D") == 0) {
		    i++;
		    DEBUG = atoi( argv[i]);
		  } else if( strcmp( argv[i], "-d") == 0) {
		    daemon = 1;
		  }
		}
	}
	else
	{
		printf( "Syntax: hvcontrol <st.cmd> [-d] [-D <debuglevel>]\n");
		printf( "              -d = run in daemon mode\n");
		printf( "              <debuglevel> = 0 no messages\n");
		printf( "              <debuglevel> = 10 all available messages\n");
	}

	if (strlen(stcmd)>0)	iocsh(stcmd);

	if (daemon)	{
		for(;;)
			epicsThreadSleep(1.0);
	} else {
		iocsh(NULL);
	}
	Shutdown();
    epicsExit(0);
	return(0);
}
开发者ID:ISISComputingGroup,项目名称:EPICS-ioc,代码行数:43,代码来源:HVCAENSIM-IOC-01Main.cpp


示例14: test_msg_throttle

TEST_CASE test_msg_throttle()
{
    ThrottledMsgLogger throttle("Test", 2.0);
    // OK to print one message.
    throttle.LOG_MSG("Hello!\n");
    // Then, messages are discouraged...
    TEST(!throttle.isPermitted());
    throttle.LOG_MSG("Hello, too!\n");
    throttle.LOG_MSG("Hello, too!\n");
    throttle.LOG_MSG("Hello, too!\n");
    throttle.LOG_MSG("Hello, too!\n");
    throttle.LOG_MSG("Hello, too!\n");

    TEST_MSG(1, "waiting a little bit...");
    epicsThreadSleep(2.5);
    throttle.LOG_MSG("Hello again\n");

    TEST_OK;
}
开发者ID:epicsdeb,项目名称:channelarchiver,代码行数:19,代码来源:ThrottledMsgLoggerTest.cpp


示例15: jbk_artificial_load

/* Some sample loads on MVME167:
*
*	-> sp jbk_artificial_load, 100000000, 10000, 1
*		Load average: 69%
*	-> sp jbk_artificial_load, 100000000, 100000, 1
*		Load average: 95%
*	-> sp jbk_artificial_load, 100000000, 25000, 1
*		Load average: 88%
*/
int jbk_artificial_load(unsigned long iter,unsigned long often,unsigned long tick_delay)
{
    volatile unsigned long i;
    double   delay = (double)tick_delay * epicsThreadSleepQuantum();

    if(iter==0)
    {
        printf("Usage: jbk_artificial_load(num_iterations,iter_betwn_delays,tick_delay)\n");
        return 0;
    }

    for(i=0; i<iter; i++)
    {
        if(i%often==0)
            epicsThreadSleep(delay);
    }

    return 0;
}
开发者ID:timmmooney,项目名称:iocStats,代码行数:28,代码来源:devIocStatsTest.c


示例16: connect

bool PvaClientMultiMonitorDouble::poll()
{
    if(!isMonitorConnected){
         connect();
         epicsThreadSleep(.01);
    }
    bool result = false;
    shared_vector<epics::pvData::boolean> isConnected = pvaClientMultiChannel->getIsConnected();
    for(size_t i=0; i<nchannel; ++i)
    {
         if(isConnected[i]) {
              if(pvaClientMonitor[i]->poll()) {
                   doubleValue[i] = pvaClientMonitor[i]->getData()->getDouble();
                   pvaClientMonitor[i]->releaseEvent();
                   result = true;
              }
         }
    }
    return result;
}
开发者ID:mdavidsaver,项目名称:easyPVACPP,代码行数:20,代码来源:pvaClientMultiMonitorDouble.cpp


示例17: interruptThread

static void interruptThread(drvPvt *pdrvPvt)
{
    while(1) {
        epicsEventMustWait(pdrvPvt->waitWork);
        while(1) {
            int addr;
            epicsUInt32 value;
            ELLLIST *pclientList;
            interruptNode *pnode;
            asynUInt32DigitalInterrupt *pinterrupt;

            if(pdrvPvt->interruptDelay <= .0001) break;
            for(addr=0; addr<NCHANNELS; addr++) {
                chanPvt *pchannel = &pdrvPvt->channel[addr];
                epicsMutexMustLock(pdrvPvt->lock);
                value = pchannel->value;
                if(value<0xf) {
                    value +=1;
                } else if(value&0x80000000) {
                    value = 0;
                } else {
                    value <<= 1;
                }
                pchannel->value = value;
                epicsMutexUnlock(pdrvPvt->lock);
            }
            pasynManager->interruptStart(
                pdrvPvt->asynUInt32DigitalPvt,&pclientList);
            pnode = (interruptNode *)ellFirst(pclientList);
            while (pnode) {
                pinterrupt = pnode->drvPvt;
                addr = pinterrupt->addr;
                pinterrupt->callback(pinterrupt->userPvt, pinterrupt->pasynUser,
                                     pdrvPvt->channel[addr].value);
                pnode = (interruptNode *)ellNext(&pnode->node);
            }
            pasynManager->interruptEnd(pdrvPvt->asynUInt32DigitalPvt);
            epicsThreadSleep(pdrvPvt->interruptDelay);
        }
    }
}
开发者ID:ukaea,项目名称:epics,代码行数:41,代码来源:uint32DigitalDriver.c


示例18: mdsPlusShotID

void mdsPlusShotID(int param)
{
    int status;
    char buf[40];
    DBADDR    *paddr;

    paddr = (DBADDR *)dbCalloc(1, sizeof(struct dbAddr));

    /* sleep */
    epicsThreadSleep(2.0);
    /*status = dbPutLink(shotIdOutLink, DBR_LONG, &shotId, 1);*/
    /* Put next pulse number */
    sprintf(buf, "icrf:pulseid.VAL");
    status = dbNameToAddr(buf, paddr);
    status = dbPutField(paddr, DBR_LONG, &shotId, 1);

    free(paddr);
    if(genSubDebug > 0)
         printf("genSub: mdsPlusShotID()  next shot number [%ld]. Status=%d\n",shotId,status);

}
开发者ID:Sangil-Lee,项目名称:RefCode,代码行数:21,代码来源:waveformGenSub.c


示例19: epicsThreadOnce

epicsShareFunc void epicsShareAPI epicsThreadOnce(epicsThreadOnceId *id, void (*func)(void *), void *arg)
{
    static struct epicsThreadOSD threadOnceComplete;
    #define EPICS_THREAD_ONCE_DONE &threadOnceComplete
    int status;

    epicsThreadInit();
    status = mutexLock(&onceLock);
    if(status) {
        fprintf(stderr,"epicsThreadOnce: pthread_mutex_lock returned %s.\n",
            strerror(status));
        exit(-1);
    }

    if (*id != EPICS_THREAD_ONCE_DONE) {
        if (*id == EPICS_THREAD_ONCE_INIT) { /* first call */
            *id = epicsThreadGetIdSelf();    /* mark active */
            status = pthread_mutex_unlock(&onceLock);
            checkStatusQuit(status,"pthread_mutex_unlock", "epicsThreadOnce");
            func(arg);
            status = mutexLock(&onceLock);
            checkStatusQuit(status,"pthread_mutex_lock", "epicsThreadOnce");
            *id = EPICS_THREAD_ONCE_DONE;    /* mark done */
        } else if (*id == epicsThreadGetIdSelf()) {
            status = pthread_mutex_unlock(&onceLock);
            checkStatusQuit(status,"pthread_mutex_unlock", "epicsThreadOnce");
            cantProceed("Recursive epicsThreadOnce() initialization\n");
        } else
            while (*id != EPICS_THREAD_ONCE_DONE) {
                /* Another thread is in the above func(arg) call. */
                status = pthread_mutex_unlock(&onceLock);
                checkStatusQuit(status,"pthread_mutex_unlock", "epicsThreadOnce");
                epicsThreadSleep(epicsThreadSleepQuantum());
                status = mutexLock(&onceLock);
                checkStatusQuit(status,"pthread_mutex_lock", "epicsThreadOnce");
            }
    }
    status = pthread_mutex_unlock(&onceLock);
    checkStatusQuit(status,"pthread_mutex_unlock","epicsThreadOnce");
}
开发者ID:T-A-R-L-A,项目名称:EPICS-Base,代码行数:40,代码来源:osdThread.c


示例20: mrmEvgSoftTime

/*
 * This function spawns additional thread that emulate PPS input. Function is used for
 * testing of timestamping functionality... DO NOT USE IN PRODUCTION!!!!!
 *
 * Change by: tslejko
 * Reason: testing utilities
 */
void mrmEvgSoftTime(void* pvt) {
    evgMrm* evg = static_cast<evgMrm*>(pvt);

    if (!evg) {
        errlogPrintf("mrmEvgSoftTimestamp: Could not find EVG!\n");
    }

    while (1) {
        epicsUInt32 data = evg->sendTimestamp();
        if (!data){
            errlogPrintf("mrmEvgSoftTimestamp: Could not retrive timestamp...\n");
            epicsThreadSleep(1);
            continue;
        }

        //Send out event reset
        evg->getSoftEvt()->setEvtCode(MRF_EVENT_TS_COUNTER_RST);

        //Clock out data...
        for (int i = 0; i < 32; data <<= 1, i++) {
            if (data & 0x80000000)
                evg->getSoftEvt()->setEvtCode(MRF_EVENT_TS_SHIFT_1);
            else
                evg->getSoftEvt()->setEvtCode(MRF_EVENT_TS_SHIFT_0);
        }

        struct timespec sleep_until_t;

        clock_gettime(CLOCK_REALTIME,&sleep_until_t); //Get current time
        /* Sleep until next full second */
        sleep_until_t.tv_nsec=0;
        sleep_until_t.tv_sec++;

        clock_nanosleep(CLOCK_REALTIME,TIMER_ABSTIME,&sleep_until_t,0);


//		sleep(1);
    }
}
开发者ID:paulscherrerinstitute,项目名称:mrfioc2,代码行数:46,代码来源:evgInit.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ epoll_create函数代码示例发布时间:2022-05-30
下一篇:
C++ epicsThreadGetStackSize函数代码示例发布时间: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