1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 <2024> 2025 | Index | 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 <2024> 2025 |
<== Date ==> | <== Thread ==> |
---|
Subject: | Re: Guaranteeing access to consistent state in asyn-backed waveforms |
From: | Mark Rivers via Tech-talk <tech-talk at aps.anl.gov> |
To: | "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov>, Érico Nogueira Rolim <erico.rolim at lnls.br> |
Date: | Sat, 6 Jul 2024 13:35:11 +0000 |
Hi Érico,
Assuming you have not enabled ring buffers for the waveform record, then the record will have the new data when doCallbacksInt32Array() returns.
There is no guarantee that the other records will have processed when the last one does, but they will have the new data.
The device support code that copies the data to the records when your driver calls doCallbacksInt32Array() is here:
Mark
From: Tech-talk <tech-talk-bounces at aps.anl.gov> on behalf of Érico Nogueira Rolim via Tech-talk <tech-talk at aps.anl.gov>
Sent: Friday, July 5, 2024 12:46 PM To: tech-talk at aps.anl.gov <tech-talk at aps.anl.gov> Subject: Guaranteeing access to consistent state in asyn-backed waveforms Hi, folks!
I have an asynPortDriver with array parameters and multiple channels. For all of these, I use aai records with "I/O Intr" SCAN. For one of these parameters, I run doCallbacksInt32Array() in a loop, doing it for each channel in order. Afterwards, I'd like to feed these resulting waveforms into an aSub record, making sure I use the updated values for all of them. I'm currently using this same aSub record for calculations with scalar records as well, which I can make sure are up to date by using PP input links [1]; this takes advantage of the default readInt32() implementation. However, I would like to avoid using PP input links for the arrays, since it would require implementing readInt32Array(), and using up memory for the arrays inside the driver. If I use a CP input link for the last channel, can that guarantee that the records for all previous channels have already been updated as well? > From what I understand the callback queue is per record (but there also isn't buffering for waveform PVs... does that mean that a record has already been updated when doCallbacksInt32Array() returns?). I can't use CP for all input links, which would guarantee an eventually correct value, but would also mean the aSub could have wrong values, calculated with inconsistent data, temporarily. One possible way I thought of, though IMO it would be quite messy and hard to maintain, would be to have a FLNK from each aai record to add 1 to a counter, which, when it reaches the number of channels, triggers the aSub record; I'd rather avoid that. [1] https://urldefense.us/v3/__https://github.com/lnls-dig/afc-epics-ioc/blob/7f0235987f7bac60787035e1b260c4018a885d55/utcaApp/Db/pos_calc.template*L121__;Iw!!G_uCfscf7eWS!YR9ISOwILEKj4QSRCVmLyVDPAVmyyM7Sg2LDHw2w7zD1JnBmcyWR9XvbXoDxpzXnxlEIVIeXcOxPmqjG34yd-ugayH0$ Cheers, Érico Aviso Legal: Esta mensagem e seus anexos podem conter informações confidenciais e/ou de uso restrito. Observe atentamente seu conteúdo e considere eventual consulta ao remetente antes de copiá-la, divulgá-la ou distribuí-la. Se você recebeu esta mensagem por engano, por favor avise o remetente e apague-a imediatamente. Disclaimer: This email and its attachments may contain confidential and/or privileged information. Observe its content carefully and consider possible querying to the sender before copying, disclosing or distributing it. If you have received this email by mistake, please notify the sender and delete it immediately. |