wantianmin,
It's possible to overcome this, though it might not be a good idea,
depending on what link processing you have in mind.
If you look at the record's process() routine, in
base/src/rec/aSubRecord.c, you'll see what it's doing to execute
output links. If you do this in your routine, you can cause both
input and output links to execute in any order you want. If your routine
returns 0, however, the output links will all be executed again. If your
routine returns other than 0 (no doubt this value was intended to signal
an error), the record will not execute the output links, but (currently)
this doesn't put the record into an alarm state, so the only side effect
will be that the record ends up with a nonzero VAL field.
Maybe there should be a return value that calls for no output link
processing but that doesn't also indicate an error.
If you plan an extended series of (write, read, decide, write, read, ...),
or if any of the records you write to are asynchronous, and you wait for
the result of their processing, your record is not going to play well with
other records that are executed by the same task. (For example, if your
record is periodically scanned, all the other records scanned with the same
period will be forced to wait for your record to finish before they will be
processed.)
It might be that your purpose would be better served by an SNL program.
Tim Mooney
----- Original Message -----
From: "wantianmin"<[email protected]>
To: [email protected]
Sent: Wednesday, December 1, 2010 8:55:28 PM
Subject: question about aSubRecord
Hi ,all:
When I use aSubRecord record to do some process, It was found that write
operation is not being done until myAsubProcess() finish.Is there some
way to overcome it?
here is a description of my situation:
db:
record(aSub,"asub")
{
field(INAM,"myAsubInit")
field(SNAM,"myAsubProcess")
field(FTA,"DOUBLE")
field(NOA,"1")
field(INPA,"test4 CA")
field(FTVA,"DOUBLE")
field(NOVA,"1")
field(OUTA,"test1 CA")
field(FTVB,"DOUBLE")
field(NOVB,"1")
field(OUTB,"test2 CA ")
}
dbSubExample.cpp:
static long myAsubProcess(aSubRecord *precord)
{
if (mySubDebug)
printf("Record %s called myAsubProcess(%p)\n",
precord->name, (void*) precord);
printf(" begin process\n");
double* p1=(double*)precord->vala;
p1[0]=20;
printf(" write vala 1 to 20 complete....\n");
double* p2=(double*)precord->a;
printf(" read from a :%lf\n complete",p2);
printf(" end process\n");
return 0;
}
I found that When I doing dbpf asub.PROC 1 in iocshell,
the first output value (test1) is not changed until the process finished.
but in some application ,I need to write some pv and read it again to
decide what is need to do next.
Is there some suggestions?
Thanks a lot
Best Regards
wantianmin
SSRF