From ddaa6e4eb6647545db7a43c9b83ca7e2c497f3b8 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Mon, 23 Jun 2014 16:28:26 -0400 Subject: [PATCH] dbNotify: cleanup atexit --- src/ioc/db/dbNotify.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/ioc/db/dbNotify.c b/src/ioc/db/dbNotify.c index 020f6d7c7..66253736c 100644 --- a/src/ioc/db/dbNotify.c +++ b/src/ioc/db/dbNotify.c @@ -44,6 +44,7 @@ #include "recGbl.h" #include "dbNotify.h" #include "epicsTime.h" +#include "epicsExit.h" #include "cantProceed.h" /*notify state values */ @@ -298,6 +299,14 @@ static void notifyCallback(CALLBACK *pcallback) callDone(precord, ppn); } +static void dbProcessNotifyExit(void* junk) +{ + assert(ellCount(&pnotifyGlobal->freeList)==0); + epicsMutexDestroy(pnotifyGlobal->lock); + free(pnotifyGlobal); + pnotifyGlobal = NULL; +} + void dbProcessNotifyInit(void) { if (pnotifyGlobal) @@ -305,6 +314,7 @@ void dbProcessNotifyInit(void) pnotifyGlobal = dbCalloc(1,sizeof(notifyGlobal)); pnotifyGlobal->lock = epicsMutexMustCreate(); ellInit(&pnotifyGlobal->freeList); + epicsAtExit(dbProcessNotifyExit, NULL); } void dbProcessNotify(processNotify *ppn)