From 3995dbafdbc87dccec7b2af1863da1ae207ecbcf Mon Sep 17 00:00:00 2001 From: William Lupton Date: Thu, 4 Jun 1998 19:32:12 +0000 Subject: [PATCH] addition of intLock()/intUnlock() (BESSY) --- src/dev/symbDev/devAiSymb.c | 6 +++++- src/dev/symbDev/devAoSymb.c | 8 +++++++- src/dev/symbDev/devBiSymb.c | 14 +++++++++----- src/dev/symbDev/devBoSymb.c | 16 +++++++++++----- src/dev/symbDev/devLiSymb.c | 8 ++++++-- src/dev/symbDev/devLoSymb.c | 10 ++++++++-- src/dev/symbDev/devMbbiSymb.c | 14 +++++++++----- src/dev/symbDev/devMbboSymb.c | 14 ++++++++++---- src/dev/symbDev/devSiSymb.c | 16 ++++++++++------ src/dev/symbDev/devSoSymb.c | 14 +++++++++----- src/dev/symbDev/devSymb.h | 6 ++++++ src/dev/symbDev/devWfSymb.c | 8 ++++++-- 12 files changed, 96 insertions(+), 38 deletions(-) diff --git a/src/dev/symbDev/devAiSymb.c b/src/dev/symbDev/devAiSymb.c index 7a53f3aed..ec8f41e3c 100644 --- a/src/dev/symbDev/devAiSymb.c +++ b/src/dev/symbDev/devAiSymb.c @@ -47,12 +47,13 @@ #include #include #include +#include #include #include #include #include -#include +#include #include #include #include @@ -100,10 +101,13 @@ static long read_ai(pai) { long status; struct vxSym *private = (struct vxSym *) pai->dpvt; + int lockKey; if (private) { + lockKey = intLock(); pai->val = *((double *)(*private->ppvar) + private->index); + intUnlock(lockKey); status = 0; } else diff --git a/src/dev/symbDev/devAoSymb.c b/src/dev/symbDev/devAoSymb.c index 6b598081f..2f4b25d97 100644 --- a/src/dev/symbDev/devAoSymb.c +++ b/src/dev/symbDev/devAoSymb.c @@ -46,11 +46,12 @@ #include #include #include +#include #include #include #include -#include +#include #include #include #include @@ -97,9 +98,14 @@ static long write_ao(pao) struct aoRecord *pao; { struct vxSym *private = (struct vxSym *) pao->dpvt; + int lockKey; if (private) + { + lockKey = intLock(); *((double *)(*private->ppvar) + private->index) = pao->val; + intUnlock(lockKey); + } else return(1); diff --git a/src/dev/symbDev/devBiSymb.c b/src/dev/symbDev/devBiSymb.c index 17f622895..e1102f715 100644 --- a/src/dev/symbDev/devBiSymb.c +++ b/src/dev/symbDev/devBiSymb.c @@ -43,15 +43,16 @@ */ #include -#include +#include #include #include #include +#include #include #include #include -#include +#include #include #include #include @@ -95,16 +96,19 @@ static long init_record(pbi) static long read_bi(pbi) struct biRecord *pbi; { + int lockKey; long status; struct vxSym *private = (struct vxSym *) pbi->dpvt; if (pbi->dpvt) { - pbi->val = *((unsigned short *)(*private->ppvar) + private->index); - status = 0; + lockKey = intLock(); + pbi->val = *((unsigned short *)(*private->ppvar) + private->index); + intUnlock(lockKey); + status = 0; } else - status = 1; + status = 1; if(RTN_SUCCESS(status)) pbi->udf=FALSE; diff --git a/src/dev/symbDev/devBoSymb.c b/src/dev/symbDev/devBoSymb.c index 0909e7ad3..a4c972fe7 100644 --- a/src/dev/symbDev/devBoSymb.c +++ b/src/dev/symbDev/devBoSymb.c @@ -44,15 +44,16 @@ #include -#include +#include #include #include #include +#include #include #include #include -#include +#include #include #include #include @@ -96,12 +97,17 @@ static long init_record(pbo) static long write_bo(pbo) struct boRecord *pbo; { + int lockKey; struct vxSym *private = (struct vxSym *) pbo->dpvt; - + if (private) - *((unsigned short *)(*private->ppvar) + private->index) = pbo->val; + { + lockKey = intLock(); + *((unsigned short *)(*private->ppvar) + private->index) = pbo->val; + intUnlock(lockKey); + } else - return(1); + return(1); pbo->udf=FALSE; diff --git a/src/dev/symbDev/devLiSymb.c b/src/dev/symbDev/devLiSymb.c index adff71fc9..99c64af12 100644 --- a/src/dev/symbDev/devLiSymb.c +++ b/src/dev/symbDev/devLiSymb.c @@ -42,15 +42,16 @@ */ #include -#include +#include #include #include #include +#include #include #include #include -#include +#include #include #include #include @@ -96,10 +97,13 @@ static long read_longin(plongin) { long status; struct vxSym *private = (struct vxSym *) plongin->dpvt; + int lockKey; if (plongin->dpvt) { + lockKey = intLock(); plongin->val = *((long *)(*private->ppvar) + private->index); + intUnlock(lockKey); status = 0; } else diff --git a/src/dev/symbDev/devLoSymb.c b/src/dev/symbDev/devLoSymb.c index 99c080cec..00272e3b8 100644 --- a/src/dev/symbDev/devLoSymb.c +++ b/src/dev/symbDev/devLoSymb.c @@ -43,15 +43,16 @@ #include -#include +#include #include #include #include +#include #include #include #include -#include +#include #include #include #include @@ -96,9 +97,14 @@ static long write_longout(plongout) struct longoutRecord *plongout; { struct vxSym *private = (struct vxSym *) plongout->dpvt; + int lockKey; if (private) + { + lockKey = intLock(); *((long *)(*private->ppvar) + private->index) = plongout->val; + intUnlock(lockKey); + } else return(1); diff --git a/src/dev/symbDev/devMbbiSymb.c b/src/dev/symbDev/devMbbiSymb.c index 0e65392c9..6996dee8e 100644 --- a/src/dev/symbDev/devMbbiSymb.c +++ b/src/dev/symbDev/devMbbiSymb.c @@ -43,15 +43,16 @@ */ #include -#include +#include #include #include #include +#include #include #include #include -#include +#include #include #include #include @@ -95,16 +96,19 @@ static long init_record(pmbbi) static long read_mbbi(pmbbi) struct mbbiRecord *pmbbi; { + int lockKey; long status; struct vxSym *private = (struct vxSym *) pmbbi->dpvt; if (pmbbi->dpvt) { - pmbbi->val = *((long *)(*private->ppvar) + private->index); - status = 0; + lockKey = intLock(); + pmbbi->val = *((long *)(*private->ppvar) + private->index); + intUnlock(lockKey); + status = 0; } else - status = 1; + status = 1; if(RTN_SUCCESS(status)) pmbbi->udf=FALSE; diff --git a/src/dev/symbDev/devMbboSymb.c b/src/dev/symbDev/devMbboSymb.c index 4eec9b2e8..d0e556495 100644 --- a/src/dev/symbDev/devMbboSymb.c +++ b/src/dev/symbDev/devMbboSymb.c @@ -44,15 +44,16 @@ #include -#include +#include #include #include #include +#include #include #include #include -#include +#include #include #include #include @@ -96,12 +97,17 @@ static long init_record(pmbbo) static long write_mbbo(pmbbo) struct mbboRecord *pmbbo; { + int lockKey; struct vxSym *private = (struct vxSym *) pmbbo->dpvt; if (private) - *((long *)(*private->ppvar) + private->index) = pmbbo->val; + { + lockKey = intLock(); + *((long *)(*private->ppvar) + private->index) = pmbbo->val; + intUnlock(lockKey); + } else - return(1); + return(1); pmbbo->udf=FALSE; diff --git a/src/dev/symbDev/devSiSymb.c b/src/dev/symbDev/devSiSymb.c index dcb31c584..528e5068a 100644 --- a/src/dev/symbDev/devSiSymb.c +++ b/src/dev/symbDev/devSiSymb.c @@ -43,15 +43,16 @@ #include -#include +#include #include #include #include +#include #include #include #include -#include +#include #include #include #include @@ -95,17 +96,20 @@ static long init_record(pstringin) static long read_stringin(pstringin) struct stringinRecord *pstringin; { + int lockKey; long status; struct vxSym *private = (struct vxSym *) pstringin->dpvt; if (private) { - pstringin->val[39] = '\0'; - strncpy(pstringin->val, (char *)(*private->ppvar) + private->index, 39); - status = 0; + pstringin->val[39] = '\0'; + lockKey = intLock(); + strncpy(pstringin->val, (char *)(*private->ppvar) + private->index, 39); + intUnlock(lockKey); + status = 0; } else - status = 1; + status = 1; if(RTN_SUCCESS(status)) pstringin->udf=FALSE; diff --git a/src/dev/symbDev/devSoSymb.c b/src/dev/symbDev/devSoSymb.c index 38a6012cd..403faad21 100644 --- a/src/dev/symbDev/devSoSymb.c +++ b/src/dev/symbDev/devSoSymb.c @@ -43,15 +43,16 @@ #include -#include +#include #include #include #include +#include #include #include #include -#include +#include #include #include #include @@ -95,15 +96,18 @@ static long init_record(pstringout) static long write_stringout(pstringout) struct stringoutRecord *pstringout; { + int lockKey; struct vxSym *private = (struct vxSym *) pstringout->dpvt; if (private) { - pstringout->val[39] = '\0'; - strcpy((char *)(*private->ppvar) + private->index, pstringout->val); + pstringout->val[39] = '\0'; + lockKey = intLock(); + strcpy((char *)(*private->ppvar) + private->index, pstringout->val); + intUnlock(lockKey); } else - return(1); + return(1); pstringout->udf = FALSE; diff --git a/src/dev/symbDev/devSymb.h b/src/dev/symbDev/devSymb.h index e3fbd21a6..1409dd7ad 100644 --- a/src/dev/symbDev/devSymb.h +++ b/src/dev/symbDev/devSymb.h @@ -8,6 +8,12 @@ /* Modification History: * $Log$ + * Revision 1.1.1.1 1998/03/16 16:57:06 franksen + * Imported using tkCVS + * + * Revision 1.1 1998/01/21 20:47:44 mrk + * restructure; new Symb support + * * Revision 1.1 1996/10/24 18:29:20 wlupton * Andrew Johnson's changes (upwards-compatible) * diff --git a/src/dev/symbDev/devWfSymb.c b/src/dev/symbDev/devWfSymb.c index 329ee93c3..341159297 100644 --- a/src/dev/symbDev/devWfSymb.c +++ b/src/dev/symbDev/devWfSymb.c @@ -38,11 +38,12 @@ #include #include #include +#include #include #include #include -#include +#include #include #include #include @@ -90,16 +91,19 @@ static long read_wf(pwf) { long status, typesize; struct vxSym *private = (struct vxSym *) pwf->dpvt; + int lockKey; if (private) { typesize = sizeofTypes[pwf->ftvl]; /* Copy the data */ + lockKey = intLock(); memcpy(pwf->bptr, (char *)(*private->ppvar) + typesize * private->index, pwf->nelm * typesize); - + intUnlock(lockKey); + pwf->nord = pwf->nelm; /* We always get it all */ pwf->udf = FALSE; /* Record also does this (but shouldn't) */ status = 0;