本文整理汇总了C++中epicsThreadCreate函数的典型用法代码示例。如果您正苦于以下问题:C++ epicsThreadCreate函数的具体用法?C++ epicsThreadCreate怎么用?C++ epicsThreadCreate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了epicsThreadCreate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drvRFCTRL_Configure
int drvRFCTRL_Configure(int start, char *ip, int port)
{
int i;
epicsPrintf("*** RF CTRL START ***\n");
sprintf(lhcd_rfctrl.ip, "%s", ip);
lhcd_rfctrl.sock = set_up_tcp( ip, RFCTRL_PORT);
if(lhcd_rfctrl.sock >= 0) lhcd_rfctrl.con_stat = 1;
epicsPrintf("*** RF CTRL Connection OK ***\n");
lhcd_rfctrl.mds_status = 0;
lhcd_rfctrl.t0 = 0.0;
epicsThreadCreate("RFCTRL",
epicsThreadPriorityHigh,
epicsThreadGetStackSize(epicsThreadStackSmall),
(EPICSTHREADFUNC)GetRFCTRL_Data_Thread, &lhcd_rfctrl);
epicsThreadCreate("RFCTRL",
epicsThreadPriorityHigh,
epicsThreadGetStackSize(epicsThreadStackSmall),
(EPICSTHREADFUNC)PutRFCTRL_MDS_Thread, &lhcd_rfctrl);
return 0;
}
示例2: Run_mode
int
Run_mode(acqMaster_t *master)
{
acqEvent_t *ev;
acqScan_t *sc;
char threadName[50];
master->acqRuns = 1;
master->globalShutdown = 0;
master->globalPause = 0;
for( ev = first_acqEvent(master); ev ; ev = next_acqEvent(ev) )
{
snprintf(threadName, sizeof threadName, "event_%s", ev->eventName);
ev->outputCount = 0;
ev->state = AS_STARTUP;
ev->threadID = epicsThreadCreate(threadName, epicsThreadPriorityMedium, epicsThreadGetStackSize(epicsThreadStackMedium), (EPICSTHREADFUNC)runEvent, ev);
}
for( sc = first_acqScan(master) ; sc ; sc = next_acqScan(sc) )
{
snprintf(threadName, sizeof threadName, "scan_%s", sc->scanName);
sc->state = AS_STARTUP;
sc->threadID = epicsThreadCreate(threadName, epicsThreadPriorityMedium, epicsThreadGetStackSize(epicsThreadStackMedium), (EPICSTHREADFUNC)runAcqScan, sc);
}
master->putMode(master, AS_RUNUP);
master->messageAdd(master, "Run Mode");
return 0;
}
示例3: errlogInitPvt
static void errlogInitPvt(void *arg)
{
struct initArgs *pconfig = (struct initArgs *) arg;
epicsThreadId tid;
pvtData.errlogInitFailed = TRUE;
pvtData.buffersize = pconfig->bufsize;
pvtData.maxMsgSize = pconfig->maxMsgSize;
pvtData.msgNeeded = adjustToWorstCaseAlignment(pvtData.maxMsgSize +
sizeof(msgNode));
ellInit(&pvtData.listenerList);
ellInit(&pvtData.msgQueue);
pvtData.toConsole = TRUE;
pvtData.console = stderr;
pvtData.waitForWork = epicsEventMustCreate(epicsEventEmpty);
pvtData.listenerLock = epicsMutexMustCreate();
pvtData.msgQueueLock = epicsMutexMustCreate();
pvtData.waitForFlush = epicsEventMustCreate(epicsEventEmpty);
pvtData.flush = epicsEventMustCreate(epicsEventEmpty);
pvtData.flushLock = epicsMutexMustCreate();
pvtData.waitForExit = epicsEventMustCreate(epicsEventEmpty);
pvtData.pbuffer = callocMustSucceed(1, pvtData.buffersize,
"errlogInitPvt");
errSymBld(); /* Better not to do this lazily... */
tid = epicsThreadCreate("errlog", epicsThreadPriorityLow,
epicsThreadGetStackSize(epicsThreadStackSmall),
(EPICSTHREADFUNC)errlogThread, 0);
if (tid) {
pvtData.errlogInitFailed = FALSE;
}
}
示例4: 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);
}
示例5: make_ringThreadConfig
static drvM6802_controlThreadConfig* make_ringThreadConfig(drvM6802_taskConfig *ptaskConfig)
{
drvM6802_controlThreadConfig *pringThreadConfig = NULL;
pringThreadConfig = (drvM6802_controlThreadConfig*)malloc(sizeof(drvM6802_controlThreadConfig));
if(!pringThreadConfig) return pringThreadConfig;
sprintf(pringThreadConfig->threadName, "RING_ctrl");
pringThreadConfig->threadPriority = epicsThreadPriorityLow;
pringThreadConfig->threadStackSize = epicsThreadGetStackSize(epicsThreadStackBig);
pringThreadConfig->threadFunc = (EPICSTHREADFUNC) RingThreadFunc;
pringThreadConfig->threadParam = (void*) ptaskConfig;
/* pringThreadConfig->threadQueueId = epicsMessageQueueCreate(100,sizeof(controlThreadQueueData)); */
pringThreadConfig->threadQueueId = 0; /* we don't need this */
/* if(pringThreadConfig->threadQueueId) ptaskConfig->taskStatus |= TASK_CONTQUEUE; */
epicsThreadCreate(pringThreadConfig->threadName,
pringThreadConfig->threadPriority,
pringThreadConfig->threadStackSize,
(EPICSTHREADFUNC) pringThreadConfig->threadFunc,
(void*) pringThreadConfig->threadParam);
return pringThreadConfig;
}
示例6: dbtpn
long dbtpn(char *pname, char *pvalue)
{
struct dbChannel *chan;
tpnInfo *ptpnInfo;
processNotify *ppn=NULL;
chan = dbChannelCreate(pname);
if (!chan) {
printf("dbtpn: No such channel");
return -1;
}
ppn = dbCalloc(1, sizeof(processNotify));
ppn->requestType = pvalue ? putProcessRequest : processGetRequest;
ppn->chan = chan;
ppn->putCallback = putCallback;
ppn->getCallback = getCallback;
ppn->doneCallback = doneCallback;
ptpnInfo = dbCalloc(1, sizeof(tpnInfo));
ptpnInfo->ppn = ppn;
ptpnInfo->callbackDone = epicsEventCreate(epicsEventEmpty);
strncpy(ptpnInfo->buffer, pvalue, 80);
ptpnInfo->buffer[79] = 0;
ppn->usrPvt = ptpnInfo;
epicsThreadCreate("dbtpn", epicsThreadPriorityHigh,
epicsThreadGetStackSize(epicsThreadStackMedium), tpnThread, ptpnInfo);
return 0;
}
示例7: asynPortDriver
/// Constructor for the #NetShrVarDriver class.
/// Calls constructor for the asynPortDriver base class and sets up driver parameters.
///
/// @param[in] netvarint interface pointer created by NetShrVarConfigure()
/// @param[in] poll_ms @copydoc initArg0
/// @param[in] portName @copydoc initArg3
NetShrVarDriver::NetShrVarDriver(NetShrVarInterface* netvarint, int poll_ms, const char *portName)
: asynPortDriver(portName,
0, /* maxAddr */
static_cast<int>(netvarint->nParams()),
asynInt32Mask | asynInt32ArrayMask | asynFloat64Mask | asynFloat64ArrayMask | asynOctetMask | asynDrvUserMask, /* Interface mask */
asynInt32Mask | asynInt32ArrayMask | asynFloat64Mask | asynFloat64ArrayMask | asynOctetMask, /* Interrupt mask */
ASYN_CANBLOCK, /* asynFlags. This driver can block but it is not multi-device */
1, /* Autoconnect */
0, /* Default priority */
0), /* Default stack size*/
m_netvarint(netvarint), m_poll_ms(poll_ms), m_shutting_down(false)
{
const char *functionName = "NetShrVarDriver";
m_netvarint->createParams(this);
if (poll_ms == 0)
{
std::cerr << "Warning: driver is not polling for buffered reads, only subscribers will see changes" << std::endl;
}
epicsAtExit(epicsExitFunc, this);
// Create the thread for background tasks (not used at present, could be used for I/O intr scanning)
if (epicsThreadCreate("NetShrVarDriverTask",
epicsThreadPriorityMedium,
epicsThreadGetStackSize(epicsThreadStackMedium),
(EPICSTHREADFUNC)NetShrVarTask, this) == 0)
{
printf("%s:%s: epicsThreadCreate failure\n", driverName, functionName);
return;
}
}
示例8: mdsPlusPut
long mdsPlusPut( genSubRecord *pgsub )
{
/*char *buf = (char *)calloc(40, sizeof(char));*/
int i;
int nextPos = 0;
/* if notified new pulse set taskPos = 0 and notify next access will not be new */
if(notifyNewPulse) {
taskPos = 0;
notifyNewPulse = 0;
}
/* if startMdsPut is active, do nothing */
if(startMdsPut) {
return(0);
}
nextPos = taskPos;
pmdsPutData[nextPos].plinkout = pgsub->outa;
/*buf = (char *)pgsub->a;
sscanf(buf,"%s %s",pmdsPutData[nextPos].serverID, pmdsPutData[nextPos].treeID);
buf = (char *)pgsub->g;
sscanf(buf,"%s",pmdsPutData[nextPos].tagName);*/
sscanf(pgsub->a,"%s %s",pmdsPutData[nextPos].serverID, pmdsPutData[nextPos].treeID);
sscanf(pgsub->g,"%s",pmdsPutData[nextPos].tagName);
/* check shot number */
pmdsPutData[nextPos].shotID = *((unsigned long *)pgsub->b);
pmdsPutData[nextPos].noRd = *((unsigned long *)pgsub->c);
/* check dT and offT */
pmdsPutData[nextPos].dT = *((float *)pgsub->d);
pmdsPutData[nextPos].offT = *((float *)pgsub->e);
/* check the node is valid */
pmdsPutData[nextPos].putFlag = *((unsigned long *)pgsub->h);
if(genSubDebug > 0)
printf("genSub: Ready mdsPlusPut() shotID=%lu,treeID=%s,serverID=%s,tagName=%s, noRd=%lu\n",
pmdsPutData[nextPos].shotID, pmdsPutData[nextPos].treeID, pmdsPutData[nextPos].serverID,
pmdsPutData[nextPos].tagName, pmdsPutData[nextPos].noRd);
/* alocate data memory by noRd */
/*pmdsPutData[nextPos].dataArray = (float *)calloc(pmdsPutData[nextPos].noRd, sizeofTypes[pgsub->ftf]);*/
pmdsPutData[nextPos].dataArray = (float *)realloc(pmdsPutData[nextPos].dataArray,
pmdsPutData[nextPos].noRd * sizeofTypes[pgsub->ftf]);
/* put data */
memcpy(pmdsPutData[nextPos].dataArray, pgsub->f, pmdsPutData[nextPos].noRd*sizeof(sizeofTypes[pgsub->ftf]));
/* if taskPos is equal to the numNode-1, start mdsput and notify new pulse for next access.*/
if(taskPos == numNode - 1 ) {
notifyNewPulse = 1;
startMdsPut = 1;
epicsThreadCreate("mdsPlusPutTask",
epicsThreadPriorityLow,
epicsThreadGetStackSize(epicsThreadStackMedium),
(EPICSTHREADFUNC) mdsPlusPut_Task,
0);
} else {
taskPos = (taskPos+1)&0xf;
}
/*free(buf);*/
return(pmdsPutData[nextPos].noRd);
}
示例9: iocExit
/**
* @ingroup asub_functions
* @param[in] prec Pointer to aSub record
*/
static long iocExit(aSubRecord *prec)
{
long stat = *(long*)prec->a;
epicsThreadCreate("iocExit", epicsThreadPriorityMedium,
epicsThreadGetStackSize(epicsThreadStackMedium), exitFunc, (void*)stat);
return 0; /* process output links */
}
示例10: print_channelConfig
/*
static void print_channelConfig(drvM6802_taskConfig *ptaskConfig, int level)
{
drvM6802_channelConfig *pchannelConfig;
pchannelConfig = (drvM6802_channelConfig*) ellFirst(ptaskConfig->pchannelConfig);
while(pchannelConfig) {
epicsPrintf(" %s", pchannelConfig->chanName);
if(level>2) {
epicsPrintf("\tChannel, status: 0x%x, index: %d, gain: %f",
pchannelConfig->channelStatus,
pchannelConfig->chanIndex,
pchannelConfig->gain );
if(level>3) {
epicsPrintf(", conv.T: %f usec", pchannelConfig->conversionTime_usec);
}
}
epicsPrintf("\n");
pchannelConfig = (drvM6802_channelConfig*) ellNext(&pchannelConfig->node);
}
return;
}
*/
static drvM6802_controlThreadConfig* make_controlThreadConfig(drvM6802_taskConfig *ptaskConfig)
{
drvM6802_controlThreadConfig *pcontrolThreadConfig = NULL;
pcontrolThreadConfig = (drvM6802_controlThreadConfig*)malloc(sizeof(drvM6802_controlThreadConfig));
if(!pcontrolThreadConfig) return pcontrolThreadConfig;
sprintf(pcontrolThreadConfig->threadName, "%s_ctrl", ptaskConfig->taskName);
pcontrolThreadConfig->threadPriority = epicsThreadPriorityLow;
pcontrolThreadConfig->threadStackSize = epicsThreadGetStackSize(epicsThreadStackSmall);
pcontrolThreadConfig->threadFunc = (EPICSTHREADFUNC) controlThreadFunc;
pcontrolThreadConfig->threadParam = (void*) ptaskConfig;
pcontrolThreadConfig->threadQueueId = epicsMessageQueueCreate(100,sizeof(controlThreadQueueData));
epicsThreadCreate(pcontrolThreadConfig->threadName,
pcontrolThreadConfig->threadPriority,
pcontrolThreadConfig->threadStackSize,
(EPICSTHREADFUNC) pcontrolThreadConfig->threadFunc,
(void*) pcontrolThreadConfig->threadParam);
return pcontrolThreadConfig;
}
示例11: asynPortDriver
/// Constructor for the isisdaeDriver class.
/// Calls constructor for the asynPortDriver base class.
/// \param[in] dcomint DCOM interface pointer created by lvDCOMConfigure()
/// \param[in] portName @copydoc initArg0
daedataDriver::daedataDriver(const char *portName, const char* host)
: asynPortDriver(portName,
0, /* maxAddr */
NUM_ISISDAE_PARAMS,
asynInt32Mask | asynInt32ArrayMask | asynDrvUserMask, /* Interface mask */
asynInt32Mask | asynInt32ArrayMask, /* Interrupt mask */
ASYN_CANBLOCK , /* asynFlags. This driver can block but it is not multi-device */
1, /* Autoconnect */
0, /* Default priority */
0) /* Default stack size*/
{
const char *functionName = "daedataDriver";
// epicsThreadOnce(&onceId, initCOM, NULL);
m_udp = new DAEDataUDP(host);
createParam(P_SVN_VERSIONString, asynParamInt32, &P_SVN_VERSION);
createParam(P_FIRMWARE_VERSIONString, asynParamInt32, &P_FIRMWARE_VERSION);
createParam(P_CHANNEL_POSITIONString, asynParamInt32Array, &P_CHANNEL_POSITION);
// Create the thread for background tasks (not used at present, could be used for I/O intr scanning)
if (epicsThreadCreate("isisdaePoller",
epicsThreadPriorityMedium,
epicsThreadGetStackSize(epicsThreadStackMedium),
(EPICSTHREADFUNC)pollerThreadC, this) == 0)
{
printf("%s:%s: epicsThreadCreate failure\n", driverName, functionName);
return;
}
}
示例12: make_fpdpThreadConfig
static drvM6802_controlThreadConfig* make_fpdpThreadConfig(drvM6802_taskConfig *ptaskConfig)
{
drvM6802_controlThreadConfig *pfpdpThreadConfig = NULL;
pfpdpThreadConfig = (drvM6802_controlThreadConfig*)malloc(sizeof(drvM6802_controlThreadConfig));
if(!pfpdpThreadConfig) return pfpdpThreadConfig;
sprintf(pfpdpThreadConfig->threadName, "FPDP_ctrl");
pfpdpThreadConfig->threadPriority = epicsThreadPriorityHigh;
pfpdpThreadConfig->threadStackSize = epicsThreadGetStackSize(epicsThreadStackBig);
pfpdpThreadConfig->threadFunc = (EPICSTHREADFUNC) FPDPthreadFunc;
pfpdpThreadConfig->threadParam = (void*) ptaskConfig;
pfpdpThreadConfig->threadQueueId = epicsMessageQueueCreate(100,sizeof(bufferingThreadQueueData));
bufferingQueueID = pfpdpThreadConfig->threadQueueId;
/* pfpdpThreadConfig->threadQueueId = 0; */
/* if(pfpdpThreadConfig->threadQueueId) ptaskConfig->taskStatus |= TASK_CONTQUEUE; */
epicsThreadCreate(pfpdpThreadConfig->threadName,
pfpdpThreadConfig->threadPriority,
pfpdpThreadConfig->threadStackSize,
(EPICSTHREADFUNC) pfpdpThreadConfig->threadFunc,
(void*) pfpdpThreadConfig->threadParam);
return pfpdpThreadConfig;
}
示例13: ClockTime_Init
void ClockTime_Init(int synchronize)
{
int firstTime = 0;
epicsThreadOnce(&onceId, ClockTime_InitOnce, &firstTime);
if (synchronize == CLOCKTIME_SYNC) {
if (ClockTimePvt.synchronize == CLOCKTIME_NOSYNC) {
/* Start synchronizing */
ClockTimePvt.synchronize = synchronize;
epicsThreadCreate("ClockTimeSync", epicsThreadPriorityHigh,
epicsThreadGetStackSize(epicsThreadStackSmall),
ClockTimeSync, NULL);
}
else {
/* No change, sync thread should already be running */
}
}
else {
if (ClockTimePvt.synchronize == CLOCKTIME_SYNC) {
/* Turn off synchronization thread */
ClockTime_Shutdown(NULL);
}
else {
/* No synchronization thread */
if (firstTime)
ClockTimeGetCurrent(&ClockTimePvt.startTime);
}
}
}
示例14: dbtpn
long epicsShareAPI dbtpn(char *pname,char *pvalue)
{
long status;
tpnInfo *ptpnInfo;
DBADDR *pdbaddr=NULL;
putNotify *ppn=NULL;
char *psavevalue;
int len;
len = strlen(pvalue);
/*allocate space for value immediately following DBADDR*/
pdbaddr = dbCalloc(1,sizeof(DBADDR) + len+1);
psavevalue = (char *)(pdbaddr + 1);
strcpy(psavevalue,pvalue);
status = dbNameToAddr(pname,pdbaddr);
if(status) {
errMessage(status, "dbtpn: dbNameToAddr");
free((void *)pdbaddr);
return(-1);
}
ppn = dbCalloc(1,sizeof(putNotify));
ppn->paddr = pdbaddr;
ppn->pbuffer = psavevalue;
ppn->nRequest = 1;
ppn->dbrType = DBR_STRING;
ppn->userCallback = dbtpnCallback;
ptpnInfo = dbCalloc(1,sizeof(tpnInfo));
ptpnInfo->ppn = ppn;
ptpnInfo->callbackDone = epicsEventCreate(epicsEventEmpty);
ppn->usrPvt = ptpnInfo;
epicsThreadCreate("dbtpn",epicsThreadPriorityHigh,
epicsThreadGetStackSize(epicsThreadStackMedium),
tpnThread,ptpnInfo);
return(0);
}
示例15: asInitAsyn
int epicsShareAPI asInitAsyn(ASDBCALLBACK *pcallback)
{
if(!pacf) return(0);
if(asInitTheadId) {
errMessage(-1,"asInit: asInitTask already active");
if(pcallback) {
pcallback->status = S_asLib_InitFailed;
callbackRequest(&pcallback->callback);
}
return(-1);
}
asInitTheadId = epicsThreadCreate("asInitTask",
(epicsThreadPriorityCAServerHigh + 1),
epicsThreadGetStackSize(epicsThreadStackBig),
(EPICSTHREADFUNC)asInitTask,(void *)pcallback);
if(asInitTheadId==0) {
errMessage(0,"asInit: epicsThreadCreate Error");
if(pcallback) {
pcallback->status = S_asLib_InitFailed;
callbackRequest(&pcallback->callback);
}
asInitTheadId = 0;
}
return(0);
}