iocInit: announce "init" hooks during iocShutdown

This commit is contained in:
Michael Davidsaver
2016-03-23 20:45:19 -04:00
parent 7a1766279c
commit 3740082b61
2 changed files with 16 additions and 0 deletions
+8
View File
@@ -48,6 +48,14 @@ typedef enum {
initHookAfterDatabasePaused,
initHookAfterIocPaused, /* End of iocPause command */
initHookAtIocShutdown, /* Start of iocShutdown */
initHookAfterCaLinkClose,
initHookAfterScanShutdown,
initHookAfterCallbackShutdown,
initHookAfterCaServerStopped,
initHookAfterDatabaseStopped,
initHookAfterIocShutdown, /* End of iocShutdown */
/* Deprecated states, provided for backwards compatibility.
* These states are announced at the same point they were before,
* but will not be repeated if the IOC gets paused and restarted.
+8
View File
@@ -688,13 +688,20 @@ static void doFreeRecord(dbRecordType *pdbRecordType, dbCommon *precord,
int iocShutdown(void)
{
if (iocState == iocVirgin || iocState == iocStopped) return 0;
initHookAnnounce(initHookAtIocShutdown); // TODO: iterate hooks in reverse
iterateRecords(doCloseLinks, NULL);
initHookAnnounce(initHookAfterCaLinkClose);
if (iocBuildMode==buildIsolated) {
/* stop and "join" threads */
scanStop();
initHookAnnounce(initHookAfterScanShutdown);
callbackStop();
initHookAnnounce(initHookAfterCallbackShutdown);
}
dbCaShutdown(); /* must be before dbFreeRecord and dbChannelExit */
initHookAnnounce(initHookAfterCaServerStopped);
/* placeholder, RSRV will eventually stop here */
initHookAnnounce(initHookAfterDatabaseStopped);
if (iocBuildMode==buildIsolated) {
/* free resources */
scanCleanup();
@@ -708,6 +715,7 @@ int iocShutdown(void)
}
iocState = iocStopped;
iocBuildMode = buildRSRV;
initHookAnnounce(initHookAfterIocShutdown);
return 0;
}