scanlock for direct record access from channel filters

This commit is contained in:
Michael Davidsaver
2012-07-05 15:25:16 -04:00
parent f1c0458adc
commit 0f79bdadb4
2 changed files with 7 additions and 1 deletions

View File

@@ -17,6 +17,7 @@
#include <dbAccess.h>
#include <dbExtractArray.h>
#include <db_field_log.h>
#include <dbLock.h>
#include <recSup.h>
#include <special.h>
#include <chfPlugin.h>
@@ -105,9 +106,10 @@ static db_field_log* filter(void* pvt, dbChannel *chan, db_field_log *pfl) {
nSource > 1 &&
(prset = dbGetRset(&chan->addr)) &&
prset->get_array_info) {
prec = dbChannelRecord(chan);
dbScanLock(prec);
status = prset->get_array_info(&chan->addr, &nSource, &offset);
nTarget = wrapArrayIndices(&start, my->incr, &end, nSource);
prec = dbChannelRecord(chan);
pfl->type = dbfl_type_ref;
pfl->stat = prec->stat;
pfl->sevr = prec->sevr;
@@ -124,6 +126,7 @@ static db_field_log* filter(void* pvt, dbChannel *chan, db_field_log *pfl) {
dbExtractArrayFromRec(&chan->addr, pdst, nTarget, nSource, offset, my->incr);
pfl->u.r.field = pdst;
}
dbScanUnlock(prec);
}
/* Extract from buffer */

View File

@@ -14,6 +14,7 @@
#include <epicsExport.h>
#include <chfPlugin.h>
#include <dbLock.h>
#include <db_field_log.h>
static db_field_log* filter(void* pvt, dbChannel *chan, db_field_log *pfl) {
@@ -22,7 +23,9 @@ static db_field_log* filter(void* pvt, dbChannel *chan, db_field_log *pfl) {
/* If string or array, must make a copy (to ensure coherence between time and data) */
if (pfl->type == dbfl_type_rec) {
dbScanLock(dbChannelRecord(chan));
dbChannelMakeArrayCopy(pvt, pfl, chan);
dbScanUnlock(dbChannelRecord(chan));
}
pfl->time = now;