Skip to content

Commit

Permalink
dbCa test sync. improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
mdavidsaver committed Jun 12, 2024
1 parent 6ca716a commit c343d8a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions modules/database/src/ioc/db/dbCa.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ void testdbCaWaitForEvent(DBLINK *plink, unsigned long cnt, enum testEvent event

assert(plink->type==CA_LINK);
pca = (caLink *)plink->value.pv_link.pvt;
caLinkInc(pca);

epicsMutexMustLock(pca->lock);
assert(!pca->monitor && !pca->connect && !pca->userPvt);
Expand All @@ -239,6 +240,8 @@ void testdbCaWaitForEvent(DBLINK *plink, unsigned long cnt, enum testEvent event
dbScanUnlock(plink->precord);

epicsEventMustWait(evt);
/* ensure worker has finished executing */
dbCaSync();

dbScanLock(plink->precord);
epicsMutexMustLock(pca->lock);
Expand All @@ -250,6 +253,7 @@ void testdbCaWaitForEvent(DBLINK *plink, unsigned long cnt, enum testEvent event

epicsEventDestroy(evt);
epicsMutexUnlock(pca->lock);
caLinkDec(pca);
dbScanUnlock(plink->precord);
}

Expand Down Expand Up @@ -287,16 +291,15 @@ void dbCaSync(void)

epicsEventMustWait(wake);
/* Worker holds workListLock when calling epicsEventMustTrigger()
* we cycle through workListLock to ensure worker call to
* we hold workListLock to ensure worker call to
* epicsEventMustTrigger() returns before we destroy the event.
*/
epicsMutexMustLock(workListLock);
epicsMutexUnlock(workListLock);

assert(templink.refcount==1);

epicsMutexDestroy(templink.lock);
epicsEventDestroy(wake);
epicsMutexUnlock(workListLock);
}

void dbCaCallbackProcess(void *userPvt)
Expand Down

0 comments on commit c343d8a

Please sign in to comment.