add initHookAtPrepare

This commit is contained in:
Michael Davidsaver
2023-09-04 09:50:08 +02:00
parent ca9c957e62
commit 9f660f2238
3 changed files with 17 additions and 0 deletions

View File

@@ -50,6 +50,7 @@ void testdbPrepare(void)
{
if(!testEvtLock)
testEvtLock = epicsMutexMustCreate();
initHookAnnounce(initHookAfterPrepareDatabase);
}
void testdbReadDatabase(const char* file,
@@ -94,6 +95,7 @@ void testIocShutdownOk(void)
void testdbCleanup(void)
{
initHookAnnounce(initHookBeforeCleanupDatabase);
dbFreeBase(pdbbase);
db_cleanup_events();
initHookFree();

View File

@@ -139,6 +139,9 @@ const char *initHookName(int state)
"initHookBeforeFree",
"initHookAfterShutdown",
"initHookAfterPrepareDatabase",
"initHookBeforeCleanupDatabase",
"initHookAfterInterruptAccept",
"initHookAtEnd"
};

View File

@@ -71,6 +71,7 @@ extern "C" {
* if the IOC is later paused and restarted.
*/
typedef enum {
// iocInit() begins
initHookAtIocBuild = 0, /**< Start of iocBuild() / iocInit() */
initHookAtBeginning, /**< Database sanity checks passed */
@@ -133,6 +134,17 @@ typedef enum {
initHookAfterShutdown,
// iocShutdown() ends
/** \brief Called during testdbPrepare()
* Use this hook to repeat actions each time an empty test database is initialized.
* \since UNRELEASED Added, triggered only by unittest code.
*/
initHookAfterPrepareDatabase,
/** \brief Called during testdbCleanup()
* Use this hook to perform cleanup each time before a test database is free()'d.
* \since UNRELEASED Added, triggered only by unittest code.
*/
initHookBeforeCleanupDatabase,
/* Deprecated states: */
/** Only announced once. Deprecated in favor of initHookAfterDatabaseRunning */
initHookAfterInterruptAccept,