Avoid race in linkRetarget

Add dbCaSync() to avoid a race between a call to dbCaGetField()
and the link becoming connected.
This commit is contained in:
Michael Davidsaver
2016-02-16 15:07:40 -05:00
parent b4fd19e7db
commit 2be59e985d
4 changed files with 54 additions and 1 deletions
+8
View File
@@ -9,6 +9,7 @@
*
* Test using several stringout records to retarget the link of another record
*/
#define EPICS_DBCA_PRIVATE_API
#include <string.h>
@@ -37,6 +38,13 @@ static void testRetarget(void)
eltc(0);
testIocInitOk();
eltc(1);
/* wait for local CA links to be connected or dbPutField() will fail */
/* wait for initial CA_CONNECT actions to be processed.
* Assume that local CA links deliver callbacks synchronously
* eg. that ca_create_channel() will invoke the connection callback
* before returning.
*/
dbCaSync();
lnkmon = testMonitorCreate("rec:ai.INP", DBE_VALUE, 0);
valmon = testMonitorCreate("rec:ai", DBE_VALUE, 0);