add IOC exit hook

This commit is contained in:
Michael Davidsaver
2013-03-30 14:59:31 -04:00
parent 40fb62a142
commit bb1924e80d

View File

@ -57,16 +57,24 @@ static pystate statenames[] = {
INITST(AfterCaServerPaused), INITST(AfterCaServerPaused),
INITST(AfterDatabasePaused), INITST(AfterDatabasePaused),
INITST(AfterIocPaused), INITST(AfterIocPaused),
{(initHookState)9999, "AtIocExit"},
{(initHookState)0, NULL} {(initHookState)0, NULL}
}; };
#undef INITST #undef INITST
static void pyhook(initHookState state);
static void cleanupPy(void *junk) static void cleanupPy(void *junk)
{ {
PyThreadState *state = PyGILState_GetThisThreadState(); PyThreadState *state = PyGILState_GetThisThreadState();
PyEval_RestoreThread(state); PyEval_RestoreThread(state);
/* special "fake" hook for shutdown */
pyhook((initHookState)9999);
PyField_cleanup(); PyField_cleanup();
/* release extra reference for hooktable */ /* release extra reference for hooktable */